Nightfire
08-14-2002, 09:36 AM
$banned_ips = array("BANNED_IP", "another baned ip");
function is_ip_banned($REMOTE_ADDR,$banned_ips) {
if(is_array($banned_ips))
{
$banned_ips = str_replace("*", "[0-9]{1,3}", $banned_ips);
while (list($key,$value) = each($banned_ips))
{
if(ereg($banned_ips[$key], $REMOTE_ADDR))
{
die("You have been banned. If you believe this has been done in
error, contact the webmaster.");
}
}
}
}
I have a huge file of ip's to block for a clients site, is there an easier way to block the ip's than listing each one in the array? Can I include a file there?
function is_ip_banned($REMOTE_ADDR,$banned_ips) {
if(is_array($banned_ips))
{
$banned_ips = str_replace("*", "[0-9]{1,3}", $banned_ips);
while (list($key,$value) = each($banned_ips))
{
if(ereg($banned_ips[$key], $REMOTE_ADDR))
{
die("You have been banned. If you believe this has been done in
error, contact the webmaster.");
}
}
}
}
I have a huge file of ip's to block for a clients site, is there an easier way to block the ip's than listing each one in the array? Can I include a file there?