$time = time(); setCookie('time', $time, time() + 3600);
How to further prescribe the condition, if, for example, in 3 seconds the page is updated 2 times, then knocked out "Too fast?"
You need to build applications so that they are not afraid of frequent reboots. Read about caching. The only thing that should bother you is to reload the page with the form submitted.
That's what comes to mind immediately.
With each new update of the page, increment a certain session variable, and, accordingly, write to the array, the time created in the session, when the first increment and the last one were produced. When session variable = 3, then we look at the time when the first increment was produced, that is, the page update counter variable became equal to one. We subtract from the current time what we got. If the result is more than 2 seconds, make a message ...
if($_COOKIE['time'] <= time()+3){ echo "Слишком быстро!"; }
Note that one page may load 3 seconds. Notify, please, about the result.
$time = time(); setCookie('time', $time, time() + 3600);
if($_COOKIE['time'] <= time() + 3){ echo "Слишком быстро!"; }
if($_COOKIE['time'] <= time() + 3){ echo "Слишком быстро!"; }
Always displays "Too fast!". 3 changed to +10 and still ... - ModaLSource: https://ru.stackoverflow.com/questions/129716/
All Articles
lastAction
, ifcurrentTime - lastAction <= minTime
, then too often. PS: 3 seconds is a lot - Zowie