Well, presumably you could split $ip into an array based on whatever the
delimiter is. I just use this snippet for our intranet where everything
comes through exactly one proxy.

Cheers
Jon


-----Original Message-----
From: Tamas Arpad [mailto:[EMAIL PROTECTED]]
Sent: 19 September 2001 12:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Getting IP address


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



**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to