Re: Problem with REMOTE_ADDR
| From: | Tyler Longren | Date: | Mon, 16 Sep 2002 18:46:27 +0000 |
| Subject: | Re: Problem with REMOTE_ADDR | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116557@lists.php.net to get a copy of this message | ||
Are you viewing the page from a web browser on the server by any chance?
tyler
On Mon, 16 Sep 2002 18:42:45 +0000
"Chris Cook" <cjc1800@hotmail.com> wrote:
> Hello all,
>
> Whenever I use REMOTE_ADDR, it gives me the IP of the server. Of
> course, I am not interested in this and want the IP of the client. I
> put this code in to resolve it and it still didnt work. What am I
> doing wrong?
>
> Thanks for any help in advance,
> Chris
>
> if (getenv(HTTP_X_FORWARDED_FOR)) {
> $ip = getenv('HTTP_X_FORWARD_FOR');
> $host = gethostbyaddr($ip);
> } else {
> $ip = getenv('REMOTE_ADDR');
> $host = gethostbyaddr($ip);
> }
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device:
> http://mobile.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>