PHP verification code problems! Solution ~

Source: Internet
Author: User
PHP verification code problem !!! Solution ~~~~ I generated a verification code in code. php! How can I verify the consistency with the generated verification code in the text box when I arrive at the front-end !, Http://blog.sina.com.cn/s/blog_8b31d4dd010160fz.htmlhttp://blog.sina.com.cn/s/blog_ PHP verification code problem !!! Solution ~~~~
I generated a verification code in code. php!
How can I verify the consistency with the generated verification code in the text box when I arrive at the front-end!

------ Solution --------------------
Http://blog.sina.com.cn/s/blog_8b31d4dd010160fz.html
Http://blog.sina.com.cn/s/blog_8b31d4dd010160fp.html


You can see it.
------ Solution --------------------
Use SESSION to save the verification code string and write a verification page for verification.
------ Solution --------------------
Yes. all of the above are good methods. you can learn from them!
------ Solution --------------------
The php script of the image generates an image and saves the verification code in the SESSION. The php form can be verified.
------ Solution --------------------
If ($ ps & ($ _ POST ["code"] === _ SESSION ["code"]) {
$ _ SESSION ['name'] = $ row ['name']; // Obtain the name and store it in the SESSION.
$ _ SESSION ['User _ Shell'] = md5 ($ row ['email ']. $ row ['password']. ALL_PS); // Here, the account and password are encrypted at the first layer.
$ _ SESSION ['Times '] = mktime ();
Echo "Hello:". $ row ['name']. "Welcome back! "." Exit ";
} Elseif (! $ Ps ){
Echo "use your name or password to encrypt your records! "."
";
}
Elseif ($ _ POST ["code"]! = $ _ SESSION ["code"]) {
Echo "your certificate has been renewed! ";
}
Session_destroy ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.