RE: [PHP] Getting IP address

From: Date: Wed, 19 Sep 2001 12:06:43 +0000
Subject: RE: [PHP] Getting IP address
Groups: php.general 
Request: Send a blank email to php-general+get-67824@lists.php.net to get a copy of this message
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:sts@mail.xubion.hu] Sent: 19 September 2001 12:54 To: php-general@lists.php.net 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' **********************************************************************

« previous php.general (#67824) next »