Need help with refferer
Posted: Sun Jan 25, 2004 12:13 am
Hi, I've been trying to make anti-leech script.
everytime i do MYDOMAIN.COM/NOLEECH.PHP?download=1, it goes to error page no matter what.
I don't seem to find the problem...
?>[/php_man]
Code: Select all
<?
if ($download == 1)
$allow = array("http://MYDOMAIN/","http://MYDOMAIN/");
$reffer = $HTTP_REFERER;
if($reffer) {
$yes = 0;
while(list($domain, $subarray) = each($allow)) {
if (ereg("$reffer",$subarray)) {
$yes = 1;
}
}
if ( $yes == 1) {
header("Location: http://MYDOMAIN/THEFILE.ZIP");
} else {
header("Location: http://MYDOMAIN/ERROR.PHP");
}
} else {
header("Location: http://MYDOMAIN/ERROR.PHP");
}
?>I don't seem to find the problem...
?>[/php_man]