如何限制注册用户尝试投票两次 [英] how to restrict registered user from trying to vote twice
问题描述
我是php编码和网站设计的新手。
I'm very new to php coding and website designing.
我正在尝试开发一个在线投票系统,只允许注册用户投票。做了所有事情并且它工作正常,但我需要的帮助是在用户注销后。
I'm trying to develop an online voting system, where registered users are only allowed to vote. Have done everything and it's working fine, but the help I need is after the user have logged out.
如何让用户无法再次登录投票两次?
How can I make the user not to be able to login again and vote twice?
或
我如何才能第二次重定向用户?
How I can I redirect the user the second time?
推荐答案
这主要是一个设计问题,但有一种方法是在投票后为数据库设置一个标志用户。当用户登录时,您将检查该标志以查看是否已进行投票并相应地重定向。
This is mainly a design question but one method would be setting a flag in the database once a vote has been casted for the user. When the user logs in you would check the flag to see if a vote has been made and redirect accordingly.
该标志可以位于响应代码中,也可以位于响应数据中。
The flag can be in the response code or from the response data.
这篇关于如何限制注册用户尝试投票两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!