Monkuar Posted December 20, 2014 Share Posted December 20, 2014 (edited) PHP Websockets Rate limiter (Thanks to @Kicken for the help) How do I setup let's say... no more than 5 requests per second? Any idea? // anti flood protection if (isset($users[$clientID]['last_session_request'])) { if($users[$clientID]['last_session_request'] > ''.microtime(true).'' - 1){ // users will be redirected to this page if it makes requests faster than 1 seconds echo "Limit Reached... Simmer down!"; wsClose($clientID); }else{ } $users[$clientID]['last_session_request'] = microtime(true); } Edited December 20, 2014 by Monkuar Link to comment https://forums.phpfreaks.com/topic/293202-how-to-use-micro-time-efficiently-and-correctly/ Share on other sites More sharing options...
Ch0cu3r Posted December 21, 2014 Share Posted December 21, 2014 (edited) Locked. Do not post multiple topics for the same question/problem. Continue where you left off from your previous topic Edited December 21, 2014 by Ch0cu3r Link to comment https://forums.phpfreaks.com/topic/293202-how-to-use-micro-time-efficiently-and-correctly/#findComment-1500252 Share on other sites More sharing options...
Recommended Posts