网站做个活动,活动中用户可以提交信息(无需登录),如何限制用户重复提交?

WBOY
Release: 2016-06-06 20:41:48
Original
1132 people have browsed it

网站做个活动,活动中用户可以提交信息(无需登录),如何限制用户重复提交?

限制每台电脑只能提交一次信息

回复内容:

网站做个活动,活动中用户可以提交信息(无需登录),如何限制用户重复提交?

限制每台电脑只能提交一次信息

在进入前端页面前 给请求的session中加入令牌(也就是加入参数),提交表单时核对令牌和服务器端令牌是否相等,相等则提交并抹去令牌,否则不提交

记录ip,判断是否重复

记录ip地址和useragent到数据库,提交之前检测一下是否有相同的,然后写一个cookie到该用户,基本能杜绝,当然不能100%

cookie里记个用户标识,提交的时候提交这个标识,下次提交判断是否重复,要是还想防止机器提交,那就用验证码

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!