html5 - 关于PHP服务器时间的验证问题
滿天的星座
滿天的星座 2017-05-16 13:08:27
0
2
470

我在做一个定时预约的时候,在form表单有一个验证条件是判断了当前时间是否达到设置时间点,如果没到的话,是不能执行的

<?php
ini_set('date.timezone','Asia/Shanghai');
$setTime = date("Y-m-d");
$setTime = strtotime("$setTime 10:30:00");
 if(time() < $setTime){
     exit("未到预约时间,请稍后访问");
 }
?>

<form>……</form>

按照逻辑的话如果时间不到,表单内容是没办法访问和提交的
但是我通过表单验证码的插件记录可以看到10点29分40秒钟左右,已经有用户完成了form表单里面的验证码验证
我们自己测试时候,也不知道该用户如何操作的
(PS:我们验证使用的是阿里云的拖动验证,每一次验证都有记录值,如下图)

大神有没有谁知道这个逻辑的漏洞在什么地方,应该如何限制处理

滿天的星座
滿天的星座

reply all(2)
Ty80

Is the plug-in record of the verification code on your server? If not, I'm afraid the time is not synchronized.

Peter_Zhu

First, you are prohibiting users from accessing the page. However, when the user submits the form, the access server URL is different, that is, your form URL is index, but the server request path index/save is used to save the data through the form, so the user can directly save the data. Directly post to index/save, and your index/save request logic does not set a time limit, so the data can be inserted into the database

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!