Re: Problem with REMOTE_ADDR

From: Date: Mon, 16 Sep 2002 22:36:05 +0000
Subject: Re: Problem with REMOTE_ADDR
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-116573@lists.php.net to get a copy of this message
This is the string I use to display a user their ip address, I am not sure if this is what you are looking for but I figured I would drop my 2 cents in. <?php echo $_SERVER['REMOTE_ADDR']?> On Mon, 16 Sep 2002, Leif K-Brooks wrote: > Have you tried a web site such as www.getmyipaddress.com to see if it's > on your end or your script's? > > Chris Cook 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 > > > > > > > > -- ------------- Kevin S. Dome

« previous php.general (#116573) next »