TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Build a voting system,users vote without sign up, only once

9 点作者 hhimanshu超过 13 年前
I am implementing a suggestion system where a user can vote suggestions by other people(much like what we see on ycombinator) but here is the problem:<p>- I don't want the users to signup before they vote(why? I dont want user to bother in the very first place to signup to vote, its not convenient) - for a particular suggestion I just want them to vote ONCE, they can vote all suggestions on a page, but not more than once<p>Is it a way to achieve this? I am working on my first app and want to learn how to do this<p>Thank you people

5 条评论

bradbeattie超过 13 年前
Persistent cookies can easily be cleared. IP address limitations might prevent legitimate users behind firewalls, while allowing others to vote multiple times if they have access to multiple computers.<p>I've looked into the problem for my own voting site (<a href="https://modernballots.com/" rel="nofollow">https://modernballots.com/</a>) and I haven't found a good way of doing this for public polls where anyone's allowed to vote.<p>The solution I developed was to just create the option for private elections that require invitations to vote in. This has its own issues (most notably the distribution of invitation keys), but it's worked so far.<p>Long story short, there's no good way of doing what you're looking for unless you're willing to accept the risk of false positives, false negatives, and the problems that come with both.
dangrossman超过 13 年前
Your first line of deduping will be cookies. When there's no cookie present, also check against (user agent, IP) pairs; remarkably unique at web scale. The chances of two people with the same browser on the same OS with the same plugins behind the same IP address hitting a random website are very small, and collateral damage is limited to not letting two people at a very IT-homogenous corporation vote on the same item.
评论 #3353992 未加载
callmeed超过 13 年前
Use an evercookie (or something similar): <a href="http://samy.pl/evercookie/" rel="nofollow">http://samy.pl/evercookie/</a>
ericingram超过 13 年前
It could be gamed a bit, but I think it's worth the trade off. I did something like this with a chat system (no login to post first), and it blew up. Avg 6,000 comments a day for a while, ~500,000 comments in a year.<p>++
_ud4a超过 13 年前
there are many sample scripts already available to do this depending on what language you are using.<p>everytime a vote is done, you would capture that users IP address and store it in a database with the ID of the question they voted for. In your algorithm, before each vote check the database to make sure the user IP and the question ID already doesn't exist.
评论 #3353473 未加载
评论 #3353471 未加载