Re: ban ip addresses
- From: Willem Bogaerts <"w.bogaerts'OR1=1-- "@kratz.maardanzonderditstuk.nl>
- Date: Tue, 20 Jan 2009 10:24:56 +0100
<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/
.
- Follow-Ups:
- Re: ban ip addresses
- From: Bob Bedford
- Re: ban ip addresses
- References:
- ban ip addresses
- From: Bob Bedford
- ban ip addresses
- Prev by Date: Re: Suggested web app setup?
- Next by Date: Re: ban ip addresses
- Previous by thread: Re: ban ip addresses
- Next by thread: Re: ban ip addresses
- Index(es):
Relevant Pages
|