proxy server interfering with IP address

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
sheepz
Forum Commoner
Posts: 58
Joined: Wed Jul 06, 2005 11:35 pm

proxy server interfering with IP address

Post by sheepz »

Hi i'm just trying to retrieve an IP address from the user so i have

Code: Select all

<?
$IPaddress = getenv("REMOTE_ADDR");
$ComputerName = gethostbyaddr($_SERVER['REMOTE_ADDR']); 
echo $IPaddress;
echo $ComputerName;
?>
But we use a proxy server setting and every time a user would visit it would display the proxy server's IP "192.168.1.240" address rather than the clients IP address "192.168.1.10" Is there a way around that? Or am I retrieving it wrong?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Technically, the proxy makes a connection with your server. That is the only thing you can rely on.
sheepz
Forum Commoner
Posts: 58
Joined: Wed Jul 06, 2005 11:35 pm

Post by sheepz »

so if we're using a proxy there is no code to pickup the address of the actual clients? I'm just making sure I got this right. =)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

From your server POV the proxy is the client.

(Sometimes proxies send a header for which client they are proxying... Other times they don't. I wouldn't rely on them.)
sheepz
Forum Commoner
Posts: 58
Joined: Wed Jul 06, 2005 11:35 pm

Post by sheepz »

i see, so even if capable it's not reliable enough to use... thx... quick question whats POV?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Point Of View
sheepz
Forum Commoner
Posts: 58
Joined: Wed Jul 06, 2005 11:35 pm

Post by sheepz »

ohhh POV hehe thx
Post Reply