Connecting Tech Pros Worldwide Forums | Help | Site Map

How to detect ip address of remote computer

Member
 
Join Date: May 2007
Posts: 34
#1: Apr 3 '08
I am trying to determine the ip address of a remote computer accessing my webpage. I do this to determine if the user if logged on elsewhere. If so, the server will reject actions from the previous location and log the user in from the new location. However, since all the computers are behind the gateway, I use $_SERVER['REMOTE_ADDR']; and only get the static ip of the gateway. Is there anyway to find out which specific computer is trying to login?

If not, is there any other way of trying to keep the user session valid from one computer at one time only??

thanks.

TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#2: Apr 3 '08

re: How to detect ip address of remote computer


Hmmm, the only IP stuff I have used was the $_SERVER['REMOTE_ADDR'], so I should look into this not only for you but also for me... But a possible temporary solution:

A session should be stored in the browser, so if the user uses another computer it should not have anything from the old session.

Using this, you can remove any previous sessions by recording session name every time they log in, and then every login running a code to destroy the last session - session_destroy() - they were using and replace the session name variable with the new one.
Newbie
 
Join Date: Oct 2008
Posts: 1
#3: Oct 28 '08

re: How to detect ip address of remote computer


$_SERVER['REMOTE_ADDR'] - it's the simplest way that are not affective now...
The biggest part of users going to internet throw proxy...
But you can do something:
1) handle proxy headers (if any proxy header exist => proxy)
2) detect host name that user come from and compare it's IP with user's IP, if IP's are different => 100% proxy
3) if not 1) and not 2) => it can be real user's IP
Here you can find all proxy headers and host 'CONNECTED FROM'
IP information
Newbie
 
Join Date: Oct 2008
Posts: 16
#4: Nov 1 '08

re: How to detect ip address of remote computer


Great info. I now knew.
Reply