src/Net.php
public static function isIpLocal($ipAddr)
	{
		// $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__, $ip);
		$return = false;
		if ($ipAddr == '::1') {
			$ipAddr = '127.0.0.1';
		}
		$net_n_masks = array(
			array('127.0.0.0',		'255.0.0.0'),
			array('10.0.0.0',		'255.0.0.0'),
			array('192.168.0.0',	'255.255.0.0'),
			array('172.16.0.0',		'255.240.0.0'),
			array('169.254.0.0',	'255.255.0.0'),
		);
		foreach ($net_n_masks as $nma) {
			if (self::isIpIn($ipAddr, $nma[0], $nma[1])) {
				$return = true;
				break;
			}
		}
		// $this->debug->groupEnd();
		return $return;
	}
public static function isIpLocal($ipAddr)
	{
		// $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__, $ip);
		$return = false;
		if ($ipAddr == '::1') {
			$ipAddr = '127.0.0.1';
		}
		$net_n_masks = array(
			array('127.0.0.0',		'255.0.0.0'),
			array('10.0.0.0',		'255.0.0.0'),
			array('192.168.0.0',	'255.255.0.0'),
			array('172.16.0.0',		'255.240.0.0'),
			array('169.254.0.0',	'255.255.0.0'),
		);
		foreach ($net_n_masks as $nma) {
			if (self::isIpIn($ipAddr, $nma[0], $nma[1])) {
				$return = true;
				break;
			}
		}
		// $this->debug->groupEnd();
		return $return;
	}
public static function isIpLocal ( $ ipAddr ) { // $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__, $ip); $ return = false ; if ( $ ipAddr == '::1' ) { $ ipAddr = '127.0.0.1' ; } $ net_n_masks = array ( array ( '127.0.0.0' , '255.0.0.0' ) , array ( '10.0.0.0' , '255.0.0.0' ) , array ( '192.168.0.0' , '255.255.0.0' ) , array ( '172.16.0.0' , '255.240.0.0' ) , array ( '169.254.0.0' , '255.255.0.0' ) , ) ; foreach ( $ net_n_masks as $ nma ) { if ( self :: isIpIn ( $ ipAddr , $ nma [ 0 ] , $ nma [ 1 ] ) ) { $ return = true ; break ; } } // $this->debug->groupEnd(); return $ return ; }
Returns whether or not IP address is on a local network

@param string $ipAddr IP address

@return boolean
Returns whether or not IP address is on a local network