summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it.class b/it.class
index 87a8b07..976afe9 100644
--- a/it.class
+++ b/it.class
@@ -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;