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.

front_page_stats.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // Love or hate, this makes things a hell of a lot faster
  3. if ($Hour % 2 === 0) {
  4. $DB->query("
  5. SELECT COUNT(uid) AS Snatches
  6. FROM xbt_snatched");
  7. list($SnatchStats) = $DB->next_record();
  8. $Cache->cache_value('stats_snatches', $SnatchStats, 0);
  9. }
  10. $DB->query("
  11. SELECT IF(remaining = 0, 'Seeding', 'Leeching') AS Type,
  12. COUNT(uid)
  13. FROM xbt_files_users
  14. WHERE active = 1
  15. GROUP BY Type");
  16. $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
  17. $SeederCount = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0;
  18. $LeecherCount = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0;
  19. $Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 0);
  20. $DB->query("
  21. SELECT COUNT(ID)
  22. FROM users_main
  23. WHERE Enabled = '1'
  24. AND LastAccess > '".time_minus(3600 * 24)."'");
  25. list($UserStats['Day']) = $DB->next_record();
  26. $DB->query("
  27. SELECT COUNT(ID)
  28. FROM users_main
  29. WHERE Enabled = '1'
  30. AND LastAccess > '".time_minus(3600 * 24 * 7)."'");
  31. list($UserStats['Week']) = $DB->next_record();
  32. $DB->query("
  33. SELECT COUNT(ID)
  34. FROM users_main
  35. WHERE Enabled = '1'
  36. AND LastAccess > '".time_minus(3600 * 24 * 30)."'");
  37. list($UserStats['Month']) = $DB->next_record();
  38. $Cache->cache_value('stats_users', $UserStats, 0);