Home > Backend Development > PHP Tutorial > javascript - When inserting data into the database on a web page, if the user submits continuously at the same time!

javascript - When inserting data into the database on a web page, if the user submits continuously at the same time!

WBOY
Release: 2016-08-18 09:16:32
Original
1188 people have browsed it

Is there a way to prompt the user that you have submitted the same content more than 5 times after he has submitted it 5 times in a row?

Reply content:

Is there a way to prompt the user that you have submitted the same content more than 5 times after he has submitted it 5 times in a row?

You can use cookie or session to count, but if the user clears the cookie it will be invalid.

You can also query how many submissions there are in the database when submitting. If it is more than 5 times, submission will not be allowed.

At the same time, if you are afraid that clearing cookies will fail, maybe you can try redis cache? Use his user ID as the key. If you submit the key, +1. If not, create a new one. How many seconds should the expiration time be set?

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template