Advertisement
Guest User

Untitled

a guest
May 24th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. $cur = (!is_file($file) ? array("lastattempt"=>0,"attempts"=>0) : json_decode(file_get_contents($file), true));
  2. $file = fopen($file, "w");
  3. $cur["attempts"]++;
  4. fwrite($file, json_encode(["lastattempt"=>time(),"attempts"=>$cur["attempts"]]));
  5. if((time() - $cur["lastattempt"]) < 5){
  6. fclose($file);
  7. return false;
  8. }
  9. fwrite($file, json_encode(["lastattempt"=>time(),"attempts"=>$cur["attempts"]]));
  10. fclose($file);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement