<?php
class IPAddressChecking
{
var $ip_address;
function IPAddressChecking($address='')
{
$this->ip_address=$address;
}
function checkIPorRange ()
{
if (ereg("-",$this->ip_address)) {
$ar = explode("-",$this->ip_address);
$your_long_ip = ip2long($_SERVER["REMOTE_ADDR"]);
if ( ($your_long_ip >= ip2long($ar[0])) && ($your_long_ip <= ip2long($ar[1])) ) {
return TRUE;
}
} else {
if ($_SERVER["REMOTE_ADDR"] == $this->ip_address) {
return TRUE;
}
}
return FALSE;
}
}
?>