public function isAllowed ($ip, $priority = 'deny,allow')
	{
		
		// Convert IP to decimal
		
		$ipDec = (float)sprintf ("%u", ip2long ($ip));
		
		// Check
		
		foreach (explode (',', $priority) as $type)
		{
			
			switch ($type)
			{
				
				// Check if the IP is allowed
				
				case 'allow':
					
					foreach ($this->allowIPs as $name => $range)
					{
						if ($this->isInside ($ipDec, $name, $range))
						{
							return TRUE;
						}
					}
					
					break;
				
				// Check if IP is denied
					
				case 'deny':
					
					foreach ($this->denyIPs as $name => $range)
					{
						if ($this->isInside ($ipDec, $name, $range))
						{
							return FALSE;
						}
					}
					
					break;
				
			}
			
		}
		
		// Not allowed by default
		
		return FALSE;
		
	}
public function isAllowed ($ip, $priority = 'deny,allow')
	{
		
		// Convert IP to decimal
		
		$ipDec = (float)sprintf ("%u", ip2long ($ip));
		
		// Check
		
		foreach (explode (',', $priority) as $type)
		{
			
			switch ($type)
			{
				
				// Check if the IP is allowed
				
				case 'allow':
					
					foreach ($this->allowIPs as $name => $range)
					{
						if ($this->isInside ($ipDec, $name, $range))
						{
							return TRUE;
						}
					}
					
					break;
				
				// Check if IP is denied
					
				case 'deny':
					
					foreach ($this->denyIPs as $name => $range)
					{
						if ($this->isInside ($ipDec, $name, $range))
						{
							return FALSE;
						}
					}
					
					break;
				
			}
			
		}
		
		// Not allowed by default
		
		return FALSE;
		
	}
public function isAllowed ( $ ip , $ priority = 'deny,allow' ) { // Convert IP to decimal $ ipDec = ( float ) sprintf ( "%u" , ip2long ( $ ip ) ) ; // Check foreach ( explode ( ',' , $ priority ) as $ type ) { switch ( $ type ) { // Check if the IP is allowed case 'allow' : foreach ( $ this -> allowIPs as $ name => $ range ) { if ( $ this -> isInside ( $ ipDec , $ name , $ range ) ) { return TRUE ; } } break ; // Check if IP is denied case 'deny' : foreach ( $ this -> denyIPs as $ name => $ range ) { if ( $ this -> isInside ( $ ipDec , $ name , $ range ) ) { return FALSE ; } } break ; } } // Not allowed by default return FALSE ; }
Return whether an IP is allowed
@param string $ip IPv4 address
@param string $priority Order priority, default deny,allow
@return boolean
Return whether an IP is allowed