Home  >  Article  >  Backend Development  >  Anti-malware automatic form submission

Anti-malware automatic form submission

WBOY
WBOYOriginal
2016-08-04 09:21:371278browse

Describe the problem scenario:

For example, forum posts, registration and other submission forms. There may be some malware that simulates the process of posting form data. How to prevent automatic submission?

Just to add: It’s best not to say verification code

Reply content:

Describe the problem scenario:

For example, when posting in a forum or submitting a form such as registration, there may be some malware that simulates the process of posting form data. How can you prevent automatic submission?

Just to add: It’s best not to say verification code

  1. Define a random number session variable in the background;

  2. Output this value in the input in the form.

  3. After submission, it is judged whether the session is equal to the input value. If they are equal, the session value is changed.

This can effectively prevent repeated submissions. If you want to experience a better front-end and use JavaScript to optimize the interaction, you can check how CSRF is implemented.

1. Use CSRF,
2. Use verification code

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php message table designNext article:php message table design