Problem about getting visitor's 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
panjian
Forum Newbie
Posts: 2
Joined: Fri Feb 28, 2003 5:40 am
Location: China

Problem about getting visitor's IP address

Post by panjian »

I know that use REMOTE_ADDR can get the first IP address of the visitor.If he is using a proxy,the I can use HTTP_X_FORWARD_FOR to get his real IP address.But now the proxy is that he is using two proxies.First he shuold througn the first proxy to connect with the sencond proxy,then he visits websites with the help of the second proxy.How can I get his real IP address?(I mean that I want to get his computer's IP address,not the first proxy's IP address)
Please help me.Thanks!
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

What I'm curious about is if the person is using IP masquerading. Are you telling me that you could get the persons real IP address from that? I've never seen anyone able to get the address of my, or any other machines on the network. What's allways provided to them is the IP of the firewall.

Cheers,
BDKR
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

some proxies add the real ip to a http request. But all HTTP_X_... headers are optional, courtesy of the proxy and almost everywhere turned off by default.
panjian
Forum Newbie
Posts: 2
Joined: Fri Feb 28, 2003 5:40 am
Location: China

Post by panjian »

So you mean that I can't get the real IP address of the visitor?
We use computers of our department.And all computers should through the proxy of our department to connect the proxy of our university.Then through the proxy of our university,we can visitor the world wide web.If I can get the IP address of the visitor's computer,the online static always says there's only a visitor on my forum.But the real situation is there're more than one visitor on my forum.
Can this problem be solved?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you use sessions you can set a session variable for each user so even if they have the same IP they'll be unique. Or you could just cookie them.

http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/function.setcookie.php

Mac
Post Reply