Récupérer l'IP

    GetIp ()
    {
        if (isset($_SERVER['HTTP_CLIENT_IP']) and !empty($_SERVER['HTTP_CLIENT_IP'])) {
            $return = $_SERVER['HTTP_CLIENT_IP'];
        } else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $return = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $return = (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_CLIENT_IP']);
        }
        if (isset($_SERVER['SERVER_ADDR']) != empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $return = $_SERVER['SERVER_ADDR'];
        }
        // IP Local
        if ($return == '::1') {
            $return = '127.0.0.1';
        }
        return $return;
    }
0.036 secondes