Page 1 of 1

$_SERVER['REMOTE_ADDR']

Posted: Mon Feb 21, 2005 1:51 am
by g00fy_m
hey to all,

i am trying to host my own website, but i have a dynamic IP so i am using a ddns client. the client uses whatismyip.com, ip.dnsexit.com & ip1.dnsexit.com.

all of these router ip locators return what appears to nbe the IP address of my ISP's transparent proxy. however, if i go to scan.sygate.com (to check my ports) it returns my real ip address.

i have a page that is running $_SERVER['REMOTE_ADDR'] which also echoes the proxies address.

how do i return my real address ?? can anyone help please. as i have another domain that i pay for hosting and i can put a page on it that i can point the ddns client to.

kind regards,

g00fy

Posted: Mon Feb 21, 2005 1:54 am
by feyd
Please read the stickies in the various boards next time.


Moved to PHP - Code. :roll:

Posted: Mon Feb 21, 2005 5:50 am
by Chris Corbyn
getenv('HTTP_X_FORWARDED_FOR')

Posted: Tue Feb 22, 2005 3:59 am
by g00fy_m
thanx for that but i worked it out about 30 mins b4 your post,

this is what i came up with, then i redirected my ddns client to a directory with this as the index.php in that directory

thanx again

Code: Select all

if ($HTTP_SERVER_VARSї"HTTP_X_FORWARDED_FOR"] != ""){
       $IP = $HTTP_SERVER_VARSї"HTTP_X_FORWARDED_FOR"];
       $proxy = $HTTP_SERVER_VARSї"REMOTE_ADDR"];
       $host = @gethostbyaddr($HTTP_SERVER_VARSї"HTTP_X_FORWARDED_FOR"]);
   }else{
       $IP = $HTTP_SERVER_VARSї"REMOTE_ADDR"];
       $host = @gethostbyaddr($HTTP_SERVER_VARSї"REMOTE_ADDR"]);
   }