Answer the question
In order to leave comments, you need to log in
How to protect yourself from multiple post requests?
A person who has visited the site can "like" the product. A post request is sent and the value of the number of likes in the database is changed.
But. If he starts pressing the button many, many times, then, in fact, the same number of requests will be sent.
How to protect yourself from this?
Answer the question
In order to leave comments, you need to log in
And how to protect yourself from the fact that a person can press the F5 button many, many times?
It depends on what goals you are pursuing.
Do you want him not to accidentally click and not spend his traffic? Put a javascript check so that you don’t like like posts
Do you want that you couldn’t wind up likes? Set checks on the server side: by login, ip, session...
Do you want to avoid spamming? Well, here you already find a middle ground for limiting the number of requests from one IP \ session \ user, etc. etc.
But in general, in the format that the question is asked, this is a meaningless premature optimization. Anyone can always send a request to you - you are making a public site.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question