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!
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?
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?