Advertisement
carbonize

IP Range

Mar 12th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. if (strpos($row['ban_ip'], '-') !== false) // IP check using range
  2. {
  3.   list ($startIP, $endIP) = split('-', $row['ban_ip']);
  4.   $startIP = sprintf('%u', ip2long($startIP))
  5.   $endIP = sprintf('%u', ip2long($endIP))
  6.   $userIP = sprintf('%u', ip2long($ip));
  7.   if (($userIP >= $startIP) && ($userIP <= $endIP))
  8.   {
  9.     return true;
  10.   }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement