Search code examples
phpmysqlvoting-system

Unique IPs in a voting system


I'm creating a voting system for my PHP/MySQL website and I would like to make sure one user can only vote once. What would be a good way of doing this? So far I have thought of and semi-implemented the following:

  • Storing individual votes in the database with an IP and vote. This creates bulkiness but ensures that each user gets one vote.

  • Storing a cookie on the user's end to check if they've voted or not. This is the most simple but obviously users can just disable cookies.

What would be the most practical approach? Any other suggestions are more than welcome.


Solution

  • 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