开发者

PHP - How can I do my own human verification?

开发者 https://www.devze.com 2023-02-16 12:55 出处:网络
I\'d like to make 开发者_如何学Cmy own php script for the human verification . Like an easy series of numbers/letters (captcha), nothing special.

I'd like to make 开发者_如何学Cmy own php script for the human verification . Like an easy series of numbers/letters (captcha), nothing special.

Suggestion? Tips? Things to keep in mind?


You could use a captcha service such as recaptcha to check for a human.

Or create your own using an image library and storing the answers in a database and giving the names of the image file something that cannot be traced back to the word, you might need to make the words fuzzy as bot can use ocr.

another novel approach i saw was someone using an ascii art captcha like this

http://www.network-science.de/ascii/


this issue is widely covered by a simple google search.

you can use this tutorial example for a reference:


I keep a list of questions and their associated answer server side. When generating the HTML for a form with a question I add the randomly selected question to the form and store the index of the question (from the list of questions) in the user's session. Then, when answer is posted I can simply check the answer with the index from the session.

Worth baring in mind that:

  • questions should be easy should be
  • unambiguous and have only one
  • possible answer user can enter answer in any case

Also worth having a "why are we asking this?" bit on the form as some users may be a bit confused as to why the question is there.


You can use the GD library to accomplish this. An example of how it can be done here: http://www.php-help.ro/php-tutorials/simple-php-gd-capcha-image/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号