Search code examples
phpdoublevotevoting-system

Prevent double voting


I'm creating a web application where users will vote for some candidates by clicking thumbs up or thumbs down, and these users won't have any account on the site.

What is the best technique to use? Is it necessary to use captcha for more protection from spam?

Vote counts are expected to be millions, and the subject is not very critical as long as I get 95% accuracy that would be fine. Thanks.


Solution

  • You can combine these two methods:

    • Add a cookie to prevent multiple votes from the same machine
    • Log IP addresses and prevent voting more than a set number of times from the same address (for example, 5 times the same hour).

    This will make it possible for multiple persons to vote from the same network but still prevent excessive cheating.

    You may also make it harder to build a voting bot by adding some hidden form field with a token that must be included in the vote, and/or use Ajax for the voting. I know it's relatively easy to build a bot anyway but most cheaters aren't that smart.