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.

ocelot_info.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. #declare(strict_types=1);
  3. if (!check_perms('users_mod')) {
  4. error(403);
  5. }
  6. if (isset($_GET['userid']) && is_number($_GET['userid'])) {
  7. $UserHeavyInfo = Users::user_heavy_info($_GET['userid']);
  8. if (isset($UserHeavyInfo['torrent_pass'])) {
  9. $TorrentPass = $UserHeavyInfo['torrent_pass'];
  10. $UserPeerStats = Tracker::user_peer_count($TorrentPass);
  11. $UserInfo = Users::user_info($_GET['userid']);
  12. $UserLevel = $Classes[$UserInfo['PermissionID']]['Level'];
  13. if (!check_paranoia('leeching+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
  14. $UserPeerStats[0] = false;
  15. }
  16. if (!check_paranoia('seeding+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
  17. $UserPeerStats[1] = false;
  18. }
  19. } else {
  20. $UserPeerStats = false;
  21. }
  22. } else {
  23. $MainStats = Tracker::info();
  24. }
  25. View::show_header('Tracker info');
  26. ?>
  27. <div>
  28. <div class="header">
  29. <h2>Tracker info</h2>
  30. </div>
  31. <div class="linkbox">
  32. <a href="?action=<?=$_REQUEST['action']?>"
  33. class="brackets" />Main stats</a>
  34. </div>
  35. <div class="sidebar">
  36. <div class="box">
  37. <div class="head">
  38. <strong>User stats</strong>
  39. </div>
  40. <div class="pad">
  41. <form method="get" action="">
  42. <input type="hidden" name="action" value="ocelot_info" />
  43. <span class="label">Get stats for user</span><br />
  44. <input type="text" name="userid" placeholder="User ID" value="<?Format::form('userid')?>" />
  45. <input type="submit" value="Go" />
  46. </form>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="main_column">
  51. <div class="box">
  52. <div class="head">
  53. <strong>Numbers and such</strong>
  54. </div>
  55. <div class="pad">
  56. <?php
  57. if (!empty($UserPeerStats)) {
  58. ?>
  59. User ID: <?=$_GET['userid']?><br />
  60. Leeching: <?=$UserPeerStats[0] === false ? "hidden" : number_format($UserPeerStats[0])?><br />
  61. Seeding: <?=$UserPeerStats[1] === false ? "hidden" : number_format($UserPeerStats[1])?><br />
  62. <?php
  63. } elseif (!empty($MainStats)) {
  64. foreach ($MainStats as $Key => $Value) {
  65. if (is_numeric($Value)) {
  66. if (substr($Key, 0, 6) === "bytes ") {
  67. $Value = Format::get_size($Value);
  68. $Key = substr($Key, 6);
  69. } else {
  70. $Value = number_format($Value);
  71. }
  72. } ?>
  73. <?="$Value $Key<br />\n"?>
  74. <?php
  75. }
  76. } elseif (isset($TorrentPass)) {
  77. ?>
  78. Failed to get stats for user <?=$_GET['userid']?>
  79. <?php
  80. } elseif (isset($_GET['userid'])) {
  81. ?>
  82. User <?=display_str($_GET['userid'])?>
  83. doesn't exist
  84. <?php
  85. } else {
  86. ?>
  87. Failed to get tracker info
  88. <?php
  89. }
  90. ?>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <?php
  96. View::show_footer();