If the cidr is empty then return false.
This commit is contained in:
parent
d682dcc717
commit
d51a940d0f
|
|
@ -82,9 +82,14 @@
|
|||
|
||||
if (!function_exists('check_cidr')) {
|
||||
function check_cidr($cidr, $ip_address) {
|
||||
if (isset($cidr) && strlen($cidr) > 0) {
|
||||
list ($subnet, $mask) = explode ('/', $cidr);
|
||||
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('fix_postback')) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue