Form verification-why does the ThinkPHP form hide the hash value?

Source: Internet
Author: User
Some forms in ThinkPHP will add a hidden hash value. Read the manual to prevent repeated submission of forms and other security protection measures. what is the security protection here? Some forms in ThinkPHP will add a hidden hash value. Read the manual to prevent repeated submission of forms and other security protection measures. what is the security protection here?

Reply content:

Some forms in ThinkPHP will add a hidden hash value. Read the manual to prevent repeated submission of forms and other security protection measures. what is the security protection here?

This is to prevent repeated submissions, because sometimes we can only allow users to submit
The principle is as follows: first, the hash value is generated by the server and then saved to the session. when the user submits the hash value, the user first checks whether the session exists, if the hash value exists, it is cleared. The next time the hash value is submitted, the submission will fail because it is invalid.

Security protection should refer to CSRF cross-site request forgery

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.