BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

disable_leech.php 1.2KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. #declare(strict_types=1);
  3. // If a user has downloaded more than 10 GiBs while on ratio watch, disable leeching privileges, and send the user a message
  4. $DB->query("
  5. SELECT ID, torrent_pass
  6. FROM users_info AS i
  7. JOIN users_main AS m ON m.ID = i.UserID
  8. WHERE i.RatioWatchEnds IS NOT NULL
  9. AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
  10. AND m.Enabled = '1'
  11. AND m.can_leech = '1'");
  12. $Users = $DB->to_pair('torrent_pass', 'ID');
  13. if (count($Users) > 0) {
  14. $Subject = 'Leeching Disabled';
  15. $Message = 'You have downloaded more than 10 GB while on Ratio Watch. Your leeching privileges have been disabled. Please reread the rules.';
  16. foreach ($Users as $TorrentPass => $UserID) {
  17. Misc::send_pm($UserID, 0, $Subject, $Message);
  18. Tracker::update_tracker('update_user', array('passkey' => $TorrentPass, 'can_leech' => '0'));
  19. }
  20. $DB->query("
  21. UPDATE users_info AS i
  22. JOIN users_main AS m ON m.ID = i.UserID
  23. SET m.can_leech = '0',
  24. i.AdminComment = CONCAT('$sqltime - Leeching privileges disabled by ratio watch system for downloading more than 10 GBs on ratio watch. - required ratio: ', m.RequiredRatio, '\n\n', i.AdminComment)
  25. WHERE m.ID IN(" . implode(',', $Users) . ')');
  26. }