Re: Getting IP address
| From: | Tamas Arpad | Date: | Wed, 19 Sep 2001 11:53:55 +0000 |
| Subject: | Re: Getting IP address | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67819@lists.php.net to get a copy of this message | ||
On Wednesday 19 September 2001 13:13, Jon Haworth wrote:
> A better version would be:
>
> if (getenv(HTTP_X_FORWARDED_FOR)) {
>
> $ip=getenv(HTTP_X_FORWARDED_FOR);
> } else {
> $ip=getenv(REMOTE_ADDR);
> }
>
> This checks for proxy forwarding as well, if you just use
> REMOTE_ADDR you might end up with a proxy, not the real IP.
As I know HTTP_X_FORWARDED_FOR can contain more than one ip address,
it depends on how many proxies have forwarded the http answer.
Arpi