Limit 1 vote per IP Address?

后端 未结 7 1947
臣服心动
臣服心动 2020-12-06 02:53

What I really want is to limit 1 vote per person but the next best thing i can think of is limit 1 vote per IP address to prevent malicious users/hackers from severely tempe

7条回答
  •  猫巷女王i
    2020-12-06 03:31

    Another way to 'help' avoid cheating is to provide a 1 time use hash into the form then check if that's is valid before you count the vote.

    For example:

    When you create the voting form you make a random hash and store it in the database and put it in the form as a hidden field. (might want to add a date field to the hash database to you can clean up the unused hashes)

    Then when you get a vote POST request you can check if the supplied hash is in the database and remove it from the database so it cant be used again.


    CONS:
    Might load the database with high IO if the voting page has high traffic.
    Can't cache the page as plan html so it puts more stress on the web app.

提交回复
热议问题