src/Fasim/Core/Input.php
function ipAddress() {
		if ($this->_ipAddress !== FALSE) {
			return $this->_ipAddress;
		}
		
		$proxyIps = Cfg::get('proxy_ips');
		if ($proxyIps != '' && $_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['REMOTE_ADDR']) {
			$proxies = preg_split('/[\s,]/', $proxyIps, -1, PREG_SPLIT_NO_EMPTY);
			$proxies = is_array($proxies) ? $proxies : array($proxies);
			
			$this->_ipAddress = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
		} elseif ($_SERVER['REMOTE_ADDR'] && $_SERVER['HTTP_CLIENT_IP']) {
			$this->_ipAddress = $_SERVER['HTTP_CLIENT_IP'];
		} elseif ($_SERVER['REMOTE_ADDR']) {
			$this->_ipAddress = $_SERVER['REMOTE_ADDR'];
		} elseif ($_SERVER['HTTP_CLIENT_IP']) {
			$this->_ipAddress = $_SERVER['HTTP_CLIENT_IP'];
		} elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) {
			$this->_ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
		}
		
		if ($this->_ipAddress === FALSE) {
			$this->_ipAddress = '0.0.0.0';
			return $this->_ipAddress;
		}
		
		if (strpos($this->_ipAddress, ',') !== FALSE) {
			$x = explode(',', $this->_ipAddress);
			$this->_ipAddress = trim(end($x));
		}
		
		// if (!$this->_validIp($this->_ipAddress)) {
		// 	$this->_ipAddress = '0.0.0.0';
		// }
		
		return $this->_ipAddress;
	}
function ipAddress() {
		if ($this->_ipAddress !== FALSE) {
			return $this->_ipAddress;
		}
		
		$proxyIps = Cfg::get('proxy_ips');
		if ($proxyIps != '' && $_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['REMOTE_ADDR']) {
			$proxies = preg_split('/[\s,]/', $proxyIps, -1, PREG_SPLIT_NO_EMPTY);
			$proxies = is_array($proxies) ? $proxies : array($proxies);
			
			$this->_ipAddress = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
		} elseif ($_SERVER['REMOTE_ADDR'] && $_SERVER['HTTP_CLIENT_IP']) {
			$this->_ipAddress = $_SERVER['HTTP_CLIENT_IP'];
		} elseif ($_SERVER['REMOTE_ADDR']) {
			$this->_ipAddress = $_SERVER['REMOTE_ADDR'];
		} elseif ($_SERVER['HTTP_CLIENT_IP']) {
			$this->_ipAddress = $_SERVER['HTTP_CLIENT_IP'];
		} elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) {
			$this->_ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
		}
		
		if ($this->_ipAddress === FALSE) {
			$this->_ipAddress = '0.0.0.0';
			return $this->_ipAddress;
		}
		
		if (strpos($this->_ipAddress, ',') !== FALSE) {
			$x = explode(',', $this->_ipAddress);
			$this->_ipAddress = trim(end($x));
		}
		
		// if (!$this->_validIp($this->_ipAddress)) {
		// 	$this->_ipAddress = '0.0.0.0';
		// }
		
		return $this->_ipAddress;
	}
function ipAddress ( ) { if ( $ this -> _ipAddress !== FALSE ) { return $ this -> _ipAddress ; } $ proxyIps = Cfg :: get ( 'proxy_ips' ) ; if ( $ proxyIps != '' && $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] && $ _SERVER [ 'REMOTE_ADDR' ] ) { $ proxies = preg_split ( '/[\s,]/' , $ proxyIps , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ proxies = is_array ( $ proxies ) ? $ proxies : array ( $ proxies ) ; $ this -> _ipAddress = in_array ( $ _SERVER [ 'REMOTE_ADDR' ] , $ proxies ) ? $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] : $ _SERVER [ 'REMOTE_ADDR' ] ; } elseif ( $ _SERVER [ 'REMOTE_ADDR' ] && $ _SERVER [ 'HTTP_CLIENT_IP' ] ) { $ this -> _ipAddress = $ _SERVER [ 'HTTP_CLIENT_IP' ] ; } elseif ( $ _SERVER [ 'REMOTE_ADDR' ] ) { $ this -> _ipAddress = $ _SERVER [ 'REMOTE_ADDR' ] ; } elseif ( $ _SERVER [ 'HTTP_CLIENT_IP' ] ) { $ this -> _ipAddress = $ _SERVER [ 'HTTP_CLIENT_IP' ] ; } elseif ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) { $ this -> _ipAddress = $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ; } if ( $ this -> _ipAddress === FALSE ) { $ this -> _ipAddress = '0.0.0.0' ; return $ this -> _ipAddress ; } if ( strpos ( $ this -> _ipAddress , ',' ) !== FALSE ) { $ x = explode ( ',' , $ this -> _ipAddress ) ; $ this -> _ipAddress = trim ( end ( $ x ) ) ; } // if (!$this->_validIp($this->_ipAddress)) { // 	$this->_ipAddress = '0.0.0.0'; // } return $ this -> _ipAddress ; }
Fetch the IP Address

@access public
@return string
Fetch the IP Address