Re: ban ip addresses



<snip>
Here is the function I use to ban IP:

function isnotallowediprange($ip){
$ban_range_low = ip2long('163.0.0.0');
$ban_range_up = ip2long('172.192.255.255');
$iplong = ip2long($ip);
if (($iplong > $ban_range_low) and ($iplong < $ban_range_up)){
return true;
} else {
return false;
}
}

If you check, you will see that those numbers are negative (i.e., the highest order bit is set). Better use strings and pattern matching.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
.