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.

torrent_stats.php 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. if (!check_perms('site_view_flow')) {
  3. error(403);
  4. }
  5. View::show_header('Torrents');
  6. if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
  7. $DB->query("
  8. SELECT COUNT(ID), SUM(Size), SUM(FileCount)
  9. FROM torrents");
  10. list($TorrentCount, $TotalSize, $TotalFiles) = $DB->next_record();
  11. $DB->query("
  12. SELECT COUNT(ID)
  13. FROM users_main
  14. WHERE Enabled = '1'");
  15. list($NumUsers) = $DB->next_record();
  16. $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 1 DAY)");
  17. list($DayNum, $DaySize, $DayFiles) = $DB->next_record();
  18. $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 7 DAY)");
  19. list($WeekNum, $WeekSize, $WeekFiles) = $DB->next_record();
  20. $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 30 DAY)");
  21. list($MonthNum, $MonthSize, $MonthFiles) = $DB->next_record();
  22. $Cache->cache_value('new_torrent_stats', array($TorrentCount, $TotalSize, $TotalFiles,
  23. $NumUsers, $DayNum, $DaySize, $DayFiles,
  24. $WeekNum, $WeekSize, $WeekFiles, $MonthNum,
  25. $MonthSize, $MonthFiles), 3600);
  26. } else {
  27. list($TorrentCount, $TotalSize, $TotalFiles, $NumUsers, $DayNum, $DaySize, $DayFiles,
  28. $WeekNum, $WeekSize, $WeekFiles, $MonthNum, $MonthSize, $MonthFiles) = $TorrentStats;
  29. }
  30. ?>
  31. <div>
  32. <div class="box">
  33. <div class="head">Overall stats</div>
  34. <div class="pad">
  35. <ul class="stats nobullet">
  36. <li>
  37. <strong>Total torrents:</strong>
  38. <?=number_format($TorrentCount)?>
  39. </li>
  40. <li>
  41. <strong>Total size:</strong>
  42. <?=Format::get_size($TotalSize)?>
  43. </li>
  44. <li>
  45. <strong>Total files:</strong>
  46. <?=number_format($TotalFiles)?>
  47. </li>
  48. <br />
  49. <li>
  50. <strong>Mean torrents per user:</strong>
  51. <?=number_format($TorrentCount / $NumUsers)?>
  52. </li>
  53. <li>
  54. <strong>Mean torrent size:</strong>
  55. <?=Format::get_size($TotalSize / $TorrentCount)?>
  56. </li>
  57. <li>
  58. <strong>Mean files per torrent:</strong>
  59. <?=number_format($TotalFiles / $TorrentCount)?>
  60. </li>
  61. <li>
  62. <strong>Mean filesize:</strong>
  63. <?=Format::get_size($TotalSize / $TotalFiles)?>
  64. </li>
  65. </ul>
  66. </div>
  67. </div>
  68. <br />
  69. <div class="box">
  70. <div class="head">Upload frequency</div>
  71. <div class="pad">
  72. <ul class="stats nobullet">
  73. <li>
  74. <strong>Torrents today:</strong>
  75. <?=number_format($DayNum)?>
  76. </li>
  77. <li>
  78. <strong>Size today:</strong>
  79. <?=Format::get_size($DaySize)?>
  80. </li>
  81. <li>
  82. <strong>Files today:</strong>
  83. <?=number_format($DayFiles)?>
  84. </li>
  85. <br />
  86. <li>
  87. <strong>Torrents this week:</strong>
  88. <?=number_format($WeekNum)?>
  89. </li>
  90. <li>
  91. <strong>Size this week:</strong>
  92. <?=Format::get_size($WeekSize)?>
  93. </li>
  94. <li>
  95. <strong>Files this week:</strong>
  96. <?=number_format($WeekFiles)?>
  97. </li>
  98. <br />
  99. <li>
  100. <strong>Torrents per day this week:</strong>
  101. <?=number_format($WeekNum / 7)?>
  102. </li>
  103. <li>
  104. <strong>Size per day this week:</strong>
  105. <?=Format::get_size($WeekSize / 7)?>
  106. </li>
  107. <li>
  108. <strong>Files per day this week:</strong>
  109. <?=number_format($WeekFiles / 7)?>
  110. </li>
  111. <br />
  112. <li>
  113. <strong>Torrents this month:</strong>
  114. <?=number_format($MonthNum)?>
  115. </li>
  116. <li>
  117. <strong>Size this month:</strong>
  118. <?=Format::get_size($MonthSize)?>
  119. </li>
  120. <li>
  121. <strong>Files this month:</strong>
  122. <?=number_format($MonthFiles)?>
  123. </li>
  124. <br />
  125. <li>
  126. <strong>Torrents per day this month:</strong>
  127. <?=number_format($MonthNum / 30)?>
  128. </li>
  129. <li>
  130. <strong>Size per day this month:</strong>
  131. <?=Format::get_size($MonthSize / 30)?>
  132. </li>
  133. <li>
  134. <strong>Files per day this month:</strong>
  135. <?=number_format($MonthFiles / 30)?>
  136. </li>
  137. </ul>
  138. </div>
  139. </div>
  140. </div>
  141. <?php
  142. View::show_footer();