Advertisement
GigilinE

Untitled

Mar 15th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. <?php
  2. if ($mode_message == "message") {
  3. //CARICO I SETTAGGI PER I COUNT
  4. $name_file_settings = "arya/spam/settings.txt";
  5. $file_settings = fopen($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file_settings, "r+");
  6. $settings = explode("\n", fread($file_settings, filesize($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file_settings)));
  7. $msg_time = $settings[0];
  8. $msg_count = $settings[1];
  9. //INIZIO IL CONTROLLO DEL FLOOD
  10. if (is_dir("arya/spam")) {
  11. apiRequest("sendMessage", array(
  12. 'chat_id' => $chat_id,
  13. 'text' => "La cartella spam non esiste"
  14. ));
  15. } else {
  16. $name_file = "arya/spam/checks/" . $chat_id . "_" . $from_id . ".txt";
  17. if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file)) {
  18. $file = fopen($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file, "w+");
  19. fwrite($file, $message_date . "\n1");
  20. } else {
  21. $file = fopen($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file, "r+");
  22. $righe = explode("\n", fread($file, filesize($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file)));
  23. $tim_old = $righe[0];
  24. $cnt = $righe[1];
  25. // SECONDI
  26. if (($message_date - $tim_old) <= $msg_time) {
  27. $cnt++;
  28. fseek($file, 0);
  29. fwrite($file, $message_date . "\n" . $cnt);
  30. //MESSAGGI
  31. if ($cnt >= $msg_count) {
  32.  
  33. apiRequest("sendMessage", array(
  34. 'chat_id' => $notification_spam_id,
  35. 'text' => "time: " . $msg_time . " count: " . $msg_count
  36. ));
  37.  
  38.  
  39.  
  40. }
  41. } else {
  42. unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $name_file);
  43. }
  44. }
  45. fclose($file);
  46. }
  47. }
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement