Preventing voters from voting more than once based on IP

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
johnb
Forum Newbie
Posts: 1
Joined: Sun Sep 28, 2008 2:57 pm

Preventing voters from voting more than once based on IP

Post by johnb »

I found a good tutorial here: http://css-tricks.com/how-to-design-and ... ered-poll/ that shows a basic voting and results page made with PHP and MYSQL. The only problem is that it doesn't restrict voters from voting more than once. I was wondering if anyone could show me the PHP code for how to do this? 8O
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: Preventing voters from voting more than once based on IP

Post by The_Anomaly »

I have basically this exact topic here.

If you're looking for actual code, don't expect to find anyone to write your code here. We will point you in the right direction, but from there, you have to do the work yourself.
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Preventing voters from voting more than once based on IP

Post by papa »

I did a simple poll based on IP address a few years back. That is what I would recommend and then it's pretty easy to add more features.
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: Preventing voters from voting more than once based on IP

Post by The_Anomaly »

papa wrote:I did a simple poll based on IP address a few years back. That is what I would recommend and then it's pretty easy to add more features.
As onion2k posted in the thread I linked to above, basing on IP is a somewhat viable option. It is anything but foolproof though.

However, that would probably be best only if you temporarily "ban" that IP from voting again. As in, if you permanently ban a certain IP, it may be resigned to someone else, or someone sharing the IP may try. Basically, because IPs move around so much, you don't want to permaban them.
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Preventing voters from voting more than once based on IP

Post by papa »

The_Anomaly wrote:
papa wrote:I did a simple poll based on IP address a few years back. That is what I would recommend and then it's pretty easy to add more features.
As onion2k posted in the thread I linked to above, basing on IP is a somewhat viable option. It is anything but foolproof though.

However, that would probably be best only if you temporarily "ban" that IP from voting again. As in, if you permanently ban a certain IP, it may be resigned to someone else, or someone sharing the IP may try. Basically, because IPs move around so much, you don't want to permaban them.
I totally agree. I just think it's a good way of starting a poll. After you get the initial script up and running you can add temp. ban etc for the ips.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Preventing voters from voting more than once based on IP

Post by panic! »

What about unis/networks/schools that share an IP?
Post Reply