V
V
Vladislav2016-02-20 23:49:00
Laravel
Vladislav, 2016-02-20 23:49:00

How to make protection from flood attack in laravel?

There is a button on it hangs the output agent on pressing this button. In the POST ajax request handler.
The problem is that if you have time to click on this button several times, then the request will be sent several times (only 2 requests were always counted).
The request itself makes an entry in the table - it charges money and it turns out that it charges 2 times to the same account. After the request is completed, the status of the account changes to "enrolled" and it cannot be executed anymore, but those 2 times pass.
Is there any solution, for example, to generate a token, but only somehow do it globally for the entire framework - all requests.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-02-20
@Div100

1. It is necessary to block the button after the click
2. It is necessary to lock the record in the database before the update (google select for update)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question