$REMOTE_ADDR only returns address of DHCP

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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

$REMOTE_ADDR only returns address of DHCP

Post by Chris Corbyn »

Hi,

Does anybody know how to get the IP of the client.... not the DHCP IP but the address assigned by DHCP.

$REMOTE_ADDR returns my DHCP server not my actual IP...

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your DHCP is a proxy, most likely.. look through the server vars you get.. you may potentially see forwarded_for or similar things.. look into the proxy detection scripts that have been around.
jonemo
Forum Commoner
Posts: 28
Joined: Wed Feb 09, 2005 1:32 pm
Location: london, uk

Post by jonemo »

if it is a proxy:

Code: Select all

getenv('HTTP_X_FORWARDED_FOR')
should return an internal (class-a/b/c whatsoever) ip - what do you want to do with that?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Thanks... it's for keeping track of my own PC's IP so that when it's online a link is displayed to the ftp that is running on it. i have a dynamic IP so I needed some way to pick up the IP.
Post Reply