我正在使用一个网站(使用PHP,JavaScript和MySQL),其中包含投票系统,允许人们匿名投票,而只是一次。

它意味着我的系统必须知道谁投票(因为我必须检查用户是否已经投票或不票),但我不想在数据库中存储用户名或用户的IP地址(毁灭匿名)。我不知道如何开始,我需要一些指导方针;我应该寻找什么?

有帮助吗?

解决方案

您最糟糕的问题是如何确保用户只能投票一次,但这不是问题的重点:您正在询问如何确保Anonimity

是相当容易的:对待您使用的无论是单一投票如何作为密码,并哈希。所以让我们说参数享受你正在使用的IP。我知道这个问题,但让我们假设这是你的选择。

  • 用户投票
  • 您哈希并保存它。
  • 您甚至可以在不同的位置保存它。甚至不需要保存哈斯赫投票的哪个选项。
  • 用户再次投票 - >数据库中的IP-哈希。
  • 如果有人已经投了投票,请不要释放,不要回复“你已经投票”,但只是不要省歌。这样就没有办法甚至知道这台机器是否有投票

心中,这是关于一个问题,而不是如何确保单投票。

其他提示

As Lix stated, really the only way, without storing IP addresses or forcing users to register, would be to store a Cookie linked to a session, however of course this is by no means a solution, as Cookies can easily be cleared.

You could attempt to use a persistent Cookie solution, such as evercookie, but if I were a user of a site which implemented something like that, it would annoy me more than having to register, and no matter what methods are used, they can always be circumvented to remove the Cookie/identifying information.

Another possibility is another form of persistent Cookies which got a lot of publicity last year (or was it 2012 - I forget), which utilize Flash to store Cookies. These Cookies can be accessed in multiple browsers. One such solution is flash-cookie, but again, this is likely to annoy users, and would not be 100% reliable as not all users have Flash enabled or installed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top