Take the 2-minute tour ×  What is the best way to stop bots,
malicious users, etc. from executing php scripts too fast? Is it
ok if I use the usleep() or sleep() functions to simply do
"nothing" for a while (just before the desired code executes),
or is that plain stupid and there are better ways for this?
function login() {  //enter login code here  function logout() {
//enter logout code here  If I just put, say, usleep(3000000)
before the login and logout codes, is that ok, or are there
better, wiser ways of achieving what I want to achieve?  edit:
Based on the suggestions below, does then usleep or sleep only
cause the processor to disengage from the current script being
executed by the current user, or does it cause it to disengage
from the entire service? i.e. If one user+script invokes a
sleep/usleep, will all concurrent users+scripts be delayed too?
share|improve this question add comment  4 Answers  up vote 7
down vote accepted  The way most web servers work (Apache for
example) is to maintain a