Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cur = (!is_file($file) ? array("lastattempt"=>0,"attempts"=>0) : json_decode(file_get_contents($file), true));
- $file = fopen($file, "w");
- $cur["attempts"]++;
- fwrite($file, json_encode(["lastattempt"=>time(),"attempts"=>$cur["attempts"]]));
- if((time() - $cur["lastattempt"]) < 5){
- fclose($file);
- return false;
- }
- fwrite($file, json_encode(["lastattempt"=>time(),"attempts"=>$cur["attempts"]]));
- fclose($file);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement