1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <?php
$ouvre=fopen("google.txt","r");
while (!feof ($ouvre))
{
$lecture = fgets($ouvre, 4096);
$explode = explode("/n", $lecture);
$ip_google = $explode;
}
fclose($ouvre);
$ouvre=fopen("yahoo.txt","r");
while (!feof ($ouvre))
{
$lecture = fgets($ouvre, 4096);
$explode = explode("/n", $lecture);
$ip_yahoo = $explode;
}
fclose($ouvre);
$ouvre=fopen("msn.txt","r");
while (!feof ($ouvre))
{
$lecture = fgets($ouvre, 4096);
$explode = explode("/n", $lecture);
$ip_msn = $explode;
}
fclose($ouvre);
$country_code = $_SERVER["GEOIP_COUNTRY_CODE"];
$deny = array("SN", "TN", "TR");
$ip = $_SERVER["REMOTE_ADDR"];
if (in_array($country_code, $deny) && $ip != $ip_google && $ip != $ip_yahoo && $ip != $ip_msn)
{
header('Location: http://www.google.com/');
exit();
}
?> |
Partager