PHP implementation verification code

zhaozj2021-02-11  172

Original: Sandfish has seen some articles about the verification code for some time, is to generate a random number or symbol, generate a picture, plus some interference pixels (prevent OCR), identified by the user's naked eye Information, enter the form to submit a website verification, and you can use a feature after the verification is successful.

There is also a simple introduction to the implementation method, as follows: Code 1:

Please enter the verification code:
> > Code 2: This program has basically implemented the generation and verification function of the verification code, but the author does not know why the content of the verification code is displayed in the form, this, just limit The user must enter the verification code, but there is no prevention of malicious programs. It can be said that it is difficult, not an attack.

However, according to the original author's idea, we can save the verification string in the session, so that there is a certain security. The code is as follows: // file: authform.php