public static function is_iplocation($ip, $location)
	{
		$iplocation = false;
		if ($ip && $location)
		{
			if (!($gdb = self::getGeoDBO()))
			{
				return $iplocation;
			}

			$sql = "SELECT COUNT(*) FROM iplocation WHERE ipfrom <= INET_ATON(" . $gdb->quote($ip) . ") AND ipto >= INET_ATON(" . $gdb->quote($ip) . ") AND LOWER(location) = LOWER(" . $gdb->quote($location) . ")";
			$gdb->setQuery($sql);
			$c = $gdb->loadResult();
			if ($c > 0)
			{
				$iplocation = true;
			}
		}
		return $iplocation;
	}
public static function is_iplocation($ip, $location)
	{
		$iplocation = false;
		if ($ip && $location)
		{
			if (!($gdb = self::getGeoDBO()))
			{
				return $iplocation;
			}

			$sql = "SELECT COUNT(*) FROM iplocation WHERE ipfrom <= INET_ATON(" . $gdb->quote($ip) . ") AND ipto >= INET_ATON(" . $gdb->quote($ip) . ") AND LOWER(location) = LOWER(" . $gdb->quote($location) . ")";
			$gdb->setQuery($sql);
			$c = $gdb->loadResult();
			if ($c > 0)
			{
				$iplocation = true;
			}
		}
		return $iplocation;
	}
public static function is_iplocation ( $ ip , $ location ) { $ iplocation = false ; if ( $ ip && $ location ) { if ( ! ( $ gdb = self :: getGeoDBO ( ) ) ) { return $ iplocation ; } $ sql = "SELECT COUNT(*) FROM iplocation WHERE ipfrom <= INET_ATON(" . $ gdb -> quote ( $ ip ) . ") AND ipto >= INET_ATON(" . $ gdb -> quote ( $ ip ) . ") AND LOWER(location) = LOWER(" . $ gdb -> quote ( $ location ) . ")" ; $ gdb -> setQuery ( $ sql ) ; $ c = $ gdb -> loadResult ( ) ; if ( $ c > 0 ) { $ iplocation = true ; } } return $ iplocation ; }
Check if an IP is in a certain location

@param   string   $ip        IP address to check
@param   string   $location  Location to check in
@return  boolean  True if IP is in the location
Check if an IP is in a certain location