function ip_range_check($ip, $from, $to) { if (empty($to)) { return ip_scope_check($ip, array($from)); } $l_ip = ip2long($ip); $l_from = ip2long(ip2arrangement($from)); $l_to = ip2long(ip2arrangement($to)); return $l_from <= $l_ip && $l_ip <= $l_to; }
function isMyNet() { if (is_localIP($this->host)) { return true; } if (ip_scope_check($this->host, $this->MyNetList)) { return true; } return false; }
function isListed() { if (is_localIP($this->host)) { return FALSE; } if (ip_scope_check($this->host, $this->MyNetList)) { return FALSE; } // reverse ip を生成 $host = implode('.', $this->reverse); foreach ($this->BlockList as $zone) { if (!$zone[1]) { continue; } $lookup = $host . '.' . $zone[0]; $ip = gethostbyname($lookup); if ($this->debug) { $result = $lookup != $ip ? ' ' . $ip : ''; $this->debug_result[] = array($zone[0], $host, $result); continue; } if ($ip != $lookup) { return TRUE; } } return FALSE; }