View Full Version : Help getting IP address
Flash Gordon
06-26-2005, 09:47 PM
I'm not sure if my server is being stupid or if I am. I thought this:
echo "<br>The IP address is: " . $_SERVER['REMOTE_ADDR'];
would give me the IP address of who ever is viewing the page. However, it just gives me the IP of the server.
Am I misunderstanding the code or is my server messed up?
Thanks
FG
EDIT: $_SERVER['HTTP_CLIENT_IP']; is the IP of the user. But is this typicically?
beanSoldier
06-27-2005, 04:05 AM
yes
Flash Gordon
06-27-2005, 11:17 PM
anyone else?
I keep reading all theses tutorials that use 'REMOTE_ADDR'.
CyanBlue
06-28-2005, 12:49 AM
Go to this page...
http://cyanblue.flashvacuum.com/tmp/ip.php
and go to this page...
http://www.whatismyip.com/
and compare two... ;)
Flash Gordon
06-28-2005, 01:00 AM
from your site i got this:
The IP address via REMOTE_ADDR is: 141.XXX.XXX.XXX
The IP address via HTTP_CLIENT_IP is:
The remote addr is correct. However, on my site it give me the server IP address. Your http_client_IP was blank for some reason. :confused:
Is it a matter of PHP version of my server? Or what is happening?
TEMP LINK (***) to my version of CyanBlue's link.
CyanBlue
06-28-2005, 04:09 AM
Can you upload the PHP file to your host and post the link to it???
What's the PHP version on your server???
Flash Gordon
06-28-2005, 04:18 AM
TEMP LINK to my version of CyanBlue's link.Has the link. It is my version of what you posted.
PHP Version 4.3.4
Apache server 1.3.29 (Unix)
CyanBlue
06-28-2005, 04:23 AM
I think there is a ghost toying with your server... I've never seen that happening before...
Hm... This might be an explanation... (Don't know if it applies to this specific case though...)
http://ip-to-country.webhosting.info/node/view/212
Flash Gordon
06-28-2005, 04:30 AM
Thank you. That helps explain it a bit. It sounds like the server is on the proxy
my new results are with or without me using a proxy are:
Using REMOTE_ADDR the IP address is: xx.xxx.xxx.xxx
Using HTTP_CLIENT_IP the IP address is: xx.xx.xxx.xxx
Using HTTP_X_FORWARDED_FOR the IP address is:
CyanBlue
06-28-2005, 04:37 AM
Yeah... The same to me...
I get some weird IP address for the first one and the second one is my correct IP address and the third one is empty... Hm...
Flash Gordon
06-28-2005, 04:41 AM
kool, well thanks for your help!
Flash Gordon
07-06-2005, 06:45 PM
CHECK IT OUT!!!
My server just changed to conform (sp?) to standards! Crazy
Using REMOTE_ADDR the IP address is: xxx.xx.xx.xxx
Using HTTP_CLIENT_IP the IP address is:
Using HTTP_X_FORWARDED_FOR the IP address is:
CyanBlue
07-06-2005, 11:40 PM
So, it was actually the problem of your server??? :D
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.