Prevents repeated forms and forms from being submitted.

Source: Internet
Author: User

Prevents repeated forms and forms from being submitted.

Method 1: javascript control. Disadvantage: Generally, it is okay for users to use it. However, if you know something about js, you can force repeated submission. In addition, there is no way for you to submit it after you move it back.

Method 2: Server Control.

A token is generated in the background and stored in the session or other cache. During form rendering, a hidden token is provided to form ).

When a user submits a form:

First, determine whether the token in the form exists and reject the data;

If a token exists, check whether the token in the form is consistent with the token in the session. If the token is inconsistent, the data is denied. If the token is consistent, process the form and remove the token from the session.

After the user successfully submits the form, if the user submits the form again, the token in the session will be deleted, so that the server will tell the user "do not submit the form repeatedly !".

 

The code is not attached. That's all.

Related Article

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.