src/Scriptixru/SypexGeo/SypexGeo.php
public function getIP()
    {
        if(getenv('HTTP_CLIENT_IP'))
            $ip = getenv('HTTP_CLIENT_IP');
        elseif(getenv('HTTP_X_FORWARDED_FOR'))
            $ip = getenv('HTTP_X_FORWARDED_FOR');
        elseif(getenv('HTTP_X_FORWARDED'))
            $ip = getenv('HTTP_X_FORWARDED');
        elseif(getenv('HTTP_FORWARDED_FOR'))
            $ip = getenv('HTTP_FORWARDED_FOR');
        elseif(getenv('HTTP_FORWARDED'))
            $ip = getenv('HTTP_FORWARDED');
        else
            $ip = getenv('REMOTE_ADDR');

        $this->ip = $ip;
        $this->ipAsLong = sprintf('%u', ip2long($ip));
        return $ip;
    }
public function getIP()
    {
        if(getenv('HTTP_CLIENT_IP'))
            $ip = getenv('HTTP_CLIENT_IP');
        elseif(getenv('HTTP_X_FORWARDED_FOR'))
            $ip = getenv('HTTP_X_FORWARDED_FOR');
        elseif(getenv('HTTP_X_FORWARDED'))
            $ip = getenv('HTTP_X_FORWARDED');
        elseif(getenv('HTTP_FORWARDED_FOR'))
            $ip = getenv('HTTP_FORWARDED_FOR');
        elseif(getenv('HTTP_FORWARDED'))
            $ip = getenv('HTTP_FORWARDED');
        else
            $ip = getenv('REMOTE_ADDR');

        $this->ip = $ip;
        $this->ipAsLong = sprintf('%u', ip2long($ip));
        return $ip;
    }
public function getIP ( ) { if ( getenv ( 'HTTP_CLIENT_IP' ) ) $ ip = getenv ( 'HTTP_CLIENT_IP' ) ; elseif ( getenv ( 'HTTP_X_FORWARDED_FOR' ) ) $ ip = getenv ( 'HTTP_X_FORWARDED_FOR' ) ; elseif ( getenv ( 'HTTP_X_FORWARDED' ) ) $ ip = getenv ( 'HTTP_X_FORWARDED' ) ; elseif ( getenv ( 'HTTP_FORWARDED_FOR' ) ) $ ip = getenv ( 'HTTP_FORWARDED_FOR' ) ; elseif ( getenv ( 'HTTP_FORWARDED' ) ) $ ip = getenv ( 'HTTP_FORWARDED' ) ; else $ ip = getenv ( 'REMOTE_ADDR' ) ; $ this -> ip = $ ip ; $ this -> ipAsLong = sprintf ( '%u' , ip2long ( $ ip ) ) ; return $ ip ; }
Detect client IP address
@return string IP
Detect client IP address