Re: $REMOTE_ADDR error
| From: | Brave Cobra | Date: | Wed, 27 Jun 2001 10:13:41 +0000 |
| Subject: | Re: $REMOTE_ADDR error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55364@lists.php.net to get a copy of this message | ||
Have a look in phpinfo. You'll find the desired value there.
The reason is indeed proxying.
or try something like this :
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != "")
$ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);
}
else
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);
}
Brave Cobra
----- Original Message -----
From: "Colin May" <rael@wibble.org.uk>
To: "Christian Dechery" <lemming@vento.com.br>
Cc: <php-general@lists.php.net>
Sent: Wednesday, June 27, 2001 10:42 AM
Subject: Re: [PHP] $REMOTE_ADDR error
> Almost as if the request was proxied or redirected from the local machine
> (127.0.0.1 is the local loop back ip)
>
> Quoting Christian Dechery (Tue, Jun 26, 2001 at 10:31:54PM -0300)
> > why do $REMOTE_ADDR always returns 127.0.0.1 no matter the user's IP who
is
> > seeing the page?
> >
> > this doesn't look 'remote' to me...
> > ____________________________
> > . Christian Dechery (lemming)
> > . http://www.tanamesa.com.br
> > . Gaita-L Owner / Web Developer
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
> --
>
> Colin May - mailto:rael@wibble.org.uk -
> http://www.wibble.org.uk
> "I've got a sand storm blowing in my head seeing many colours but
> the only one coming through is red" - Sandstorm, All Change, Cast
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>