Page 1 of 1

Get Real Ip from client

Posted: Wed Apr 07, 2010 4:40 pm
by Soldiers3lite
hello,

ok, so I've tried several ways to get ip addresses from computers, I use it for a voting poll and I don't want users to vote more than once. So, I save all of the voter's IP address on the DB and I was looking for a way to get an 'authentic' IP from the client because the one that I use right now, does not work very well.

The problem with this code is that it will take a 'general' IP from a network. I have four computers on my network and whenever try it voting with the other computer, it tells me that I have already voted. Meaning that the IP has been registered already. So, I went to whatismyip.com and tried to compare if the IPs of my computers were different, and that wasn't the case.

Here is the code that I use:

Code: Select all

$ip=getenv(remote_addr);
I know it is possible, maybe some other way to compare users against the database because I have seen it and I've tried using my different computers when I vote.
Any help would be much appreciated!

Thanks in advance

Re: Get Real Ip from client

Posted: Wed Apr 07, 2010 4:49 pm
by requinix
Soldiers3lite wrote:I know it is possible
Weird, because I know it isn't.

You can't always get the IP of a computer sitting behind a router or switch. That's how the Internet works.

Re: Get Real Ip from client

Posted: Wed Apr 07, 2010 5:09 pm
by Soldiers3lite
tasairis wrote:
You can't always get the IP of a computer sitting behind a router or switch. That's how the Internet works.
I have seen other voting polls that actually work when connected on the same network. My friend and I voted on a poll and it accepted both computers. I've tried it on a school's network as well, all of the IPs seem to be the same, it won't allow me to vote from another computer on the same network. Are there other ways to get an IP more accurate?

Thanks!

Re: Get Real Ip from client

Posted: Wed Apr 07, 2010 6:07 pm
by requinix
No, not really.

Could always use cookies. Quite easy to bypass though, so a combination of cookies and IP addresses would be better than either alone.