$_SERVER['REMOTE_ADDR']

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
g00fy_m
Forum Newbie
Posts: 7
Joined: Mon Feb 21, 2005 1:46 am

$_SERVER['REMOTE_ADDR']

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Please read the stickies in the various boards next time.


Moved to PHP - Code. :roll:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

getenv('HTTP_X_FORWARDED_FOR')
g00fy_m
Forum Newbie
Posts: 7
Joined: Mon Feb 21, 2005 1:46 am

Post 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"]);
   }
Post Reply