core/Http/Request.php
public function ip()
	{
		if( is_null($this->ip_address) )
		{
			$remote = isset( $this->server["REMOTE_ADDR"] );

			if( $remote && isset( $this->server["HTTP_CLIENT_IP"] ) )
			{
				$this->ip_address = $this->server["HTTP_CLIENT_IP"];
			}
			else if( $remote )
			{
				$this->ip_address = $_SERVER["REMOTE_ADDR"];
			}
			else if ( isset( $this->server["HTTP_CLIENT_IP"] ) )
			{
				$this->ip_address = $this->server["HTTP_CLIENT_IP"];
			}
			else if( isset( $this->server["HTTP_X_FORWARDED_FOR"] ) )
			{
				$this->ip_address = $this->server["HTTP_X_FORWARDED_FOR"];
			}
			else
			{
				$this->ip_address = "0.0.0.0";
			}

			if( strpos( $this->ip_address, ',' ) !== false )
			{
				$this->ip_address = end( explode( ',', $this->ip_address ) );
			}

			if( ! $this->ip_address )
			{
				$this->ip_address = "0.0.0.0";
			}
		}

		return $this->ip_address;
	}
public function ip()
	{
		if( is_null($this->ip_address) )
		{
			$remote = isset( $this->server["REMOTE_ADDR"] );

			if( $remote && isset( $this->server["HTTP_CLIENT_IP"] ) )
			{
				$this->ip_address = $this->server["HTTP_CLIENT_IP"];
			}
			else if( $remote )
			{
				$this->ip_address = $_SERVER["REMOTE_ADDR"];
			}
			else if ( isset( $this->server["HTTP_CLIENT_IP"] ) )
			{
				$this->ip_address = $this->server["HTTP_CLIENT_IP"];
			}
			else if( isset( $this->server["HTTP_X_FORWARDED_FOR"] ) )
			{
				$this->ip_address = $this->server["HTTP_X_FORWARDED_FOR"];
			}
			else
			{
				$this->ip_address = "0.0.0.0";
			}

			if( strpos( $this->ip_address, ',' ) !== false )
			{
				$this->ip_address = end( explode( ',', $this->ip_address ) );
			}

			if( ! $this->ip_address )
			{
				$this->ip_address = "0.0.0.0";
			}
		}

		return $this->ip_address;
	}
public function ip ( ) { if ( is_null ( $ this -> ip_address ) ) { $ remote = isset ( $ this -> server [ "REMOTE_ADDR" ] ) ; if ( $ remote && isset ( $ this -> server [ "HTTP_CLIENT_IP" ] ) ) { $ this -> ip_address = $ this -> server [ "HTTP_CLIENT_IP" ] ; } else if ( $ remote ) { $ this -> ip_address = $ _SERVER [ "REMOTE_ADDR" ] ; } else if ( isset ( $ this -> server [ "HTTP_CLIENT_IP" ] ) ) { $ this -> ip_address = $ this -> server [ "HTTP_CLIENT_IP" ] ; } else if ( isset ( $ this -> server [ "HTTP_X_FORWARDED_FOR" ] ) ) { $ this -> ip_address = $ this -> server [ "HTTP_X_FORWARDED_FOR" ] ; } else { $ this -> ip_address = "0.0.0.0" ; } if ( strpos ( $ this -> ip_address , ',' ) !== false ) { $ this -> ip_address = end ( explode ( ',' , $ this -> ip_address ) ) ; } if ( ! $ this -> ip_address ) { $ this -> ip_address = "0.0.0.0" ; } } return $ this -> ip_address ; }
Gets the request IP address

@return string
Gets the request IP address