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
sheepz
Forum Commoner
Posts: 58 Joined: Wed Jul 06, 2005 11:35 pm
Post
by sheepz » Mon Apr 10, 2006 8:18 pm
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 » Mon Apr 10, 2006 8:53 pm
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 » Tue Apr 11, 2006 11:12 am
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 » Tue Apr 11, 2006 11:45 am
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 » Tue Apr 11, 2006 12:35 pm
i see, so even if capable it's not reliable enough to use... thx... quick question whats POV?
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Tue Apr 11, 2006 12:46 pm
Point Of View
sheepz
Forum Commoner
Posts: 58 Joined: Wed Jul 06, 2005 11:35 pm
Post
by sheepz » Tue Apr 11, 2006 12:52 pm
ohhh POV hehe thx