0

Well, I'm only a novice PHP programmer. However, I've been working on a contact form for a live website. I'm minimizing the troubles a legitimate user has to go through in order to stop spam bots. So I have a honeypot, but I also wanted to check the time between loading the page and clicking the submit button. I am confused on how to tell php to grab the time at the load of a page and when the submit button is pressed.

I figured I'd just do a strtotime("now") twice, at the beginning of the page and when the POST variables have been sent. But...that didn't work so much. Just confused on what functions to use. Basically just checking if the form gets filled out within a few seconds, not exactly probable for a human.

Thanks, and sorry for the stupidity.

4

1 回答 1

0

问题是加载页面并在提交时执行 POST 会加载页面两次。要让它存储您需要将其保存在 cookie 或会话变量中的时间。或者,如果这是一个表单并且您是新手,最好的方法可能是设置一个隐藏的表单变量,名称可能类似于start_time. 然后在提交表单时,将存储start_time的时间与解析时生成的时间进行比较,然后就可以了。

于 2013-11-06T04:41:16.370 回答