diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -372,7 +372,7 @@ static function toascii($text) * @param $cidrs IP range in CIDR notation (192.168.42.64/26) or array of ranges * @return true if $ip is within $cidr */ -function cidr_match($ip, $cidrs) +static function cidr_match($ip, $cidrs) { foreach ((array)$cidrs as $cidr) { @@ -381,7 +381,7 @@ function cidr_match($ip, $cidrs) $subnet_bin = inet_pton($subnet); $valid_bytes = $mask ? $mask >> 3 : 42; $bitmask = 256 - (1 << (8 - ($mask & 7))); - $lastbyte_matched = $bitmask ? (ord($ip_bin{$valid_bytes}) & $bitmask) == (ord($subnet_bin{$valid_bytes}) & $bitmask) : true; + $lastbyte_matched = $bitmask ? (ord($ip_bin[$valid_bytes]) & $bitmask) == (ord($subnet_bin[$valid_bytes]) & $bitmask) : true; if (substr($ip_bin, 0, $valid_bytes) == substr($subnet_bin, 0, $valid_bytes) && $lastbyte_matched) return true; |