protected function checkIp($ip)
{
if (false !== strpos($this->ip, '/')) {
list($address, $netmask) = explode('/', $this->ip);
if ($netmask < 1 || $netmask > 32) {
return false;
}
} else {
$address = $this->ip;
$netmask = 1;
}
return 0 === substr_compare(sprintf('%032b', ip2long($ip)), sprintf('%032b', ip2long($address)), 0, $netmask);
}