Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

php - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...