用php构建一个基本的人体测试

Im making a rudimentary "human test" for a form on my website.

I want to take the current date (to the minute, not second), and combine that with the users REMOTE_ADDR, then from that generate a string (perhaps use md5?) then limit that to 6 characters.

This code will then be presented to the user, which is instructed to copy it to a particular text box, upon submission will be verified and allow the form to process.

I dont know if there is an easier way to do this, but this is something i think will work for me and be a quick fix. Any suggestions?

I dont know if there is an easier way to do this, but this is something i think will work for me and be a quick fix. Any suggestions?

If you just need a quick fix, try for something simpler. I had a very popular website with a notoriously effective Turing Test:

Check this box if you're a human: [ ]

This little fix brought my spam count down from 10s of 1000s of messages everyday to 1 or 2 every few months. Of course, once the bots wised up, I had to make my test much more difficult:

What's the sound a cat makes? (Rhymes with 'cow') [________________]

Never had anymore problems after that. YMMV.

Generate an MD5 from any source (inc. totally random). Put it on the screen and store it in the session. Check it. Voila.

Using a captcha library is, obv. much more secure though. There's plenty of very good and very very easy to install ones about.

I would say the simplest solution would be to use a honeypot. Basically, create a hidden field called Name or something of that sort, and then check to see if the field has data upon submission. If it does, you know it is a bot! Since it is hidden, human's will not be able to populate that field, only bots will!