Re: Real IP address?
| From: | Mark Charette | Date: | Sat, 05 Aug 2000 03:16:33 +0000 |
| Subject: | Re: Real IP address? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10234@lists.php.net to get a copy of this message | ||
There's no real way to get the originators' IP if they don't want you to see
it since there's no guarantee that any of the environment variable are set
at any time and/or the existence of a VPN or NAT in between the visitor and
your server - never mind any proxies between you & them.
Mark C .
----- Original Message -----
From: "Roland Witvoet" <s441851@stud.tue.nl>
To: <php-general@lists.php.net>
Sent: Friday, August 04, 2000 10:49 PM
Subject: [PHP] Real IP address?
> I'm trying to get the IP address of a visitor.
>
> So far:
> $REMOTE_ADDR
> isn't smart to use because x.php?REMOTE_ADDR=1 will result 1 instead of
> the IP address.
>
> getenv("REMOTE_ADDR")
> is much better, but if the user uses an proxy server it will report the
> IP address of that server, not the client.
>
>
> according to http://www.php.net/manual/function.getenv.php
>
> if (getenv("HTTP_X_FORWARDED_FOR"))
> { $ip=getenv("HTTP_X_FORWARDED_FOR");
> } else
> { $ip=getenv("REMOTE_ADDR");
> }
>
> should solve this problem, but I noticed that in my case it doesn't.
> My IP address can not be found in HTTP_X_FORWARDED_FOR, but in
> HTTP_CLIENT_IP. This variable thus might be proxy server specific?
>
> Has anyone found a better (=working) way to determine the IP address of
> a client?
>
>
> --
> 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
>
>
>