Salut am si eu nevoie de putin ajutor , nu reusesc sa sortez hostname`urile care nu dorect sa-mi acceseze pagina web de cele care imi dorect sa acceseze pagina web.
<?php
function check_ban() {
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "0.0.0.0";
$host = gethostbyaddr($ip);
$ip_ban_array = array( // banned ip address list
'0.0.0.0'
);
$hostname_ban_array = array( // banned hostname list
'eu.tachyon.net',
'ttnet.net.tr',
'meteksan.net.tr',
'metu.edu.tr',
'doruk.net.tr',
'belbone.be',
'skylogicnet.com',
'telsim.com.tr',
'titannetworks.nl'
);
if (is_array($ip_ban_array)) {
if (in_array($ip, $ip_ban_array)) {
die("Site not available at the moment");
}
}
if (is_array($hostname_ban_array)) {
foreach ($hostname_ban_array as $ban_host) {
if (preg_match("/".$ban_host."\b/i", $host)) {
die("Site not available at the moment");
}
}
}
}
check_ban();
?>
as dori la acest script hostname`urile care sunt banate sa fie redirectionate pe un alt site exemplu (www.google.com) , iar cele care nu sunt mentionate in banlist sa fie redirectionate pe (www.mysite.com).
Ma poate ajuta cineva? Multumesc