Forum Moderators: coopster

Message Too Old, No Replies

$_SERVER["REMOTE_ADDR"] returns weird results...

         

irock

3:41 am on Feb 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First, thanks to those who helped me in other threads.

I now have another question/problem...

Whenever I tried to load a page with $_SERVER["REMOTE_ADDR"] to grab my own IP, I sometimes get weird results such as 203.168.223. 161 (pls don't delete this IP, which doesn't point anywhere) and 61.18.186.x, both of which aren't my IP. Do you guys know the reason why $_SERVER["REMOTE_ADDR"] would have this behaviour?

Thanks much!

ukgimp

8:15 am on Feb 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is the address of the client initiating the web request.

Could you be going through an ISP that is not issueing you a static IP?

<added>Not convinced though after reading my reply :)

You ad better wait for someone serious to come along :)</added>

Damian

1:05 pm on Feb 13, 2003 (gmt 0)

10+ Year Member



Looks like they are the ip addresses of proxy servers based in HongKong..

maybe that helps you solve the question..

Asandir

10:09 pm on Feb 18, 2003 (gmt 0)

10+ Year Member



You should be able to detect if the client is coming through a proxy - most proxies will offer a "forwarded for" IP, so that you can tell the client.

Sometimes they don't.


if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$message .= "From ".$_SERVER["HTTP_X_FORWARDED_FOR"];
$message .= " using proxy ".$_SERVER["REMOTE_ADDR"]."\n";
} else {
$message .= "From ".$_SERVER["REMOTE_ADDR"]."\n";
}