Page 1 of 1

Get ip from visiting pc/user

Posted: Fri Jul 13, 2012 10:19 am
by Axllrod
I have been looking for a way to get the ip from the visiting pc on a website. I would need the ip to check if a visitor has already submitted a form from the website. So when this pc visits the website, it doesn't show the form.
I have found this bit of code here to do so:

Code: Select all

$_SERVER['REMOTE_ADDR']
This bit of code does work and it does give an ip but it seems it's not from a pc or device.
If i try to connect with another pc on the same network (such as wifi), then it's the same ip on all the devices. So it seems it takes the ip from the router and not from the pc itself.

Thanks in advance!

Re: Get ip from visiting pc/user

Posted: Fri Jul 13, 2012 11:58 am
by Christopher
Axllrod wrote:So it seems it takes the ip from the router and not from the pc itself.
That's what a router does -- route traffic between two separate IP networks. In order to get information about the computer itself you would need to install an application on that pc that has access to the OS. Could be a browser plugin or a Java app or us one of Microsoft's several methods..

Re: Get ip from visiting pc/user

Posted: Fri Jul 13, 2012 12:39 pm
by social_experiment
Also take into account that users can visit the site through sites like anonymouse, when connecting via a proxy or non-static ip address; all these will bypass the measure you have in place