mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
If the cidr is empty then return false.
This commit is contained in:
@@ -81,9 +81,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('check_cidr')) {
|
if (!function_exists('check_cidr')) {
|
||||||
function check_cidr ($cidr,$ip_address) {
|
function check_cidr($cidr, $ip_address) {
|
||||||
list ($subnet, $mask) = explode ('/', $cidr);
|
if (isset($cidr) && strlen($cidr) > 0) {
|
||||||
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
list ($subnet, $mask) = explode ('/', $cidr);
|
||||||
|
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user