Unique Ips in a Voting System

Unique IPs in a voting system

The Unobtainably-Perfect: (Unique Govt Number)

  • User votes using a verifiable unique identifier like a social-security or passport number

The Close-Enough-For-Reality: (Email/3rd Party Auth)

  • user registers an account with an email address and password (or google/facebook)
  • 1 email address = 1 vote
  • Users can't clear cookies and get extra votes, App doesn't shut 1000's out with shared IPs

The Good-Thought-But-False-Pretense (IP addresses)

  • Office buildings: 1000's of users on the same external IP get shut-out
  • Universites: Connect to wireless in classroom. Vote. Move to next classroom. Reconnect and vote again

The Crash-And-Burn (Cookies)

  1. Vote
  2. ctrl shft del enter
  3. vote
  4. repeat

Limit 1 vote per IP Address?

I would suggest not going with the IP approach. When I looked at this before some of your large ISPs reuse IPs a lot (AOL...), but if you do use IP addresses, use a database to track them. A fast way to do it is to make it a unique key and to catch the exception as "already voted".

One good thing to add is not to show a user that their vote was not counted, just show the results, or thank them for voting. By not giving that specific error, it is harder and sometimes not even noticed by your problem users.

Database structure for voting system with up- and down votes

Regarding the comments, we found the solution that best fits to Zardoz

He does not want to always count votes and needs as much details as possible. So the solution is a mix of both.

  1. Adding an integer field in the considered table to store vote counts (make sure there won't be overflows).
  2. Create additional tables to log the votes (user, post, date, up/down, etc.)

I would recommend to use triggers to automatically update the 'vote count field' when inserting/deleting/updating a vote in the log table.



Related Topics



Leave a reply



Submit