Re: ban ip addresses

Here is the function I use to ban IP:

function isnotallowediprange($ip){
$ban_range_low = ip2long('');
$ban_range_up = ip2long('');
$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.

Relevant Pages

  • Re: spot the error
    ... You might be looking at the wrong one, especially if the above script is also included. ... Willem Bogaerts ... Application smith ...
  • Re: U.S. sees democracy coming in post-Castro Cuba
    ... Cuba already leads the region in health care and education. ... Already the best in Latin America, so the US is going to ... > of another state," Smith said. ...
  • Re: SIs Five Worst College Coaches
    ... appears in over his head in the Big Ten, ... if that was true why would Smith be in this list? ... MSU is performing at expected levels. ...
  • Re: Odd doings in California
    ... it may not be as complex as regular payroll. ... Consider, Mr Smith, that persons earning only or greater are ... While our understandings ...
  • Re: Revisiting an Old Prejudice: READ INTO/WRITE FROM
    ... Rick Smith wrote: ... >of that which can be chalked up to sloppiness, ... >storage being the NOMINAL KEY for the indexed file. ...