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.

registration_log.php 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. if (!check_perms('users_view_ips') || !check_perms('users_view_email')) {
  3. error(403);
  4. }
  5. View::show_header('Registration log');
  6. define('USERS_PER_PAGE', 50);
  7. list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
  8. $AfterDate = isset($_POST['after_date']) ? $_POST['after_date'] : null;
  9. $BeforeDate = isset($_POST['before_date']) ? $_POST['before_date'] : null;
  10. $DateSearch = false;
  11. if (!empty($AfterDate) && !empty($BeforeDate)) {
  12. list($Y, $M, $D) = explode('-', $AfterDate);
  13. if (!checkdate($M, $D, $Y)) {
  14. error('Incorrect "after" date format');
  15. }
  16. list($Y, $M, $D) = explode('-', $BeforeDate);
  17. if (!checkdate($M, $D, $Y)) {
  18. error('Incorrect "before" date format');
  19. }
  20. $AfterDate = db_string($AfterDate);
  21. $BeforeDate = db_string($BeforeDate);
  22. $DateSearch = true;
  23. }
  24. $RS = "
  25. SELECT
  26. SQL_CALC_FOUND_ROWS
  27. m.ID,
  28. m.IP,
  29. m.ipcc,
  30. m.Email,
  31. m.Username,
  32. m.PermissionID,
  33. m.Uploaded,
  34. m.Downloaded,
  35. m.Enabled,
  36. i.Donor,
  37. i.Warned,
  38. i.JoinDate,
  39. (
  40. SELECT COUNT(h1.UserID)
  41. FROM users_history_ips AS h1
  42. WHERE h1.IP = m.IP
  43. ) AS Uses,
  44. im.ID,
  45. im.IP,
  46. im.ipcc,
  47. im.Email,
  48. im.Username,
  49. im.PermissionID,
  50. im.Uploaded,
  51. im.Downloaded,
  52. im.Enabled,
  53. ii.Donor,
  54. ii.Warned,
  55. ii.JoinDate,
  56. (
  57. SELECT COUNT(h2.UserID)
  58. FROM users_history_ips AS h2
  59. WHERE h2.IP = im.IP
  60. ) AS InviterUses
  61. FROM users_main AS m
  62. LEFT JOIN users_info AS i ON i.UserID = m.ID
  63. LEFT JOIN users_main AS im ON i.Inviter = im.ID
  64. LEFT JOIN users_info AS ii ON i.Inviter = ii.UserID
  65. WHERE";
  66. if ($DateSearch) {
  67. $RS .= " i.JoinDate BETWEEN '$AfterDate' AND '$BeforeDate' ";
  68. } else {
  69. $RS .= " i.JoinDate > '".time_minus(3600 * 24 * 3)."'";
  70. }
  71. $RS .= "
  72. ORDER BY i.Joindate DESC
  73. LIMIT $Limit";
  74. $QueryID = $DB->query($RS);
  75. $DB->query('SELECT FOUND_ROWS()');
  76. list($Results) = $DB->next_record();
  77. $DB->set_query_id($QueryID);
  78. ?>
  79. <form action="" method="post" class="box pad">
  80. <input type="hidden" name="action" value="registration_log" />
  81. Joined after: <input type="date" name="after_date" />
  82. Joined before: <input type="date" name="before_date" />
  83. <input type="submit" />
  84. </form>
  85. <?php
  86. if ($DB->has_results()) {
  87. ?>
  88. <div class="linkbox">
  89. <?php
  90. $Pages = Format::get_pages($Page, $Results, USERS_PER_PAGE, 11) ;
  91. echo $Pages; ?>
  92. </div>
  93. <table width="100%">
  94. <tr class="colhead">
  95. <td>User</td>
  96. <td>Ratio</td>
  97. <td>Email</td>
  98. <td>IP address</td>
  99. <td>Country</td>
  100. <td>Host</td>
  101. <td>Registered</td>
  102. </tr>
  103. <?php
  104. while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
  105. $RowClass = $IP === $InviterIP ? 'warning' : '';
  106. $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
  107. $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
  108. $InviterEmail = apcu_exists('DBKEY') ? Crypto::decrypt($InviterEmail) : '[Encrypted]';
  109. $InviterIP = apcu_exists('DBKEY') ? Crypto::decrypt($InviterIP) : '[Encrypted]'; ?>
  110. <tr class="<?=$RowClass?>">
  111. <td>
  112. <?=Users::format_username($UserID, true, true, true, true)?><br />
  113. <?=Users::format_username($InviterID, true, true, true, true)?>
  114. </td>
  115. <td>
  116. <?=Format::get_ratio_html($Uploaded, $Downloaded)?><br />
  117. <?=Format::get_ratio_html($InviterUploaded, $InviterDownloaded)?>
  118. </td>
  119. <td>
  120. <span class="float_left">
  121. <?=display_str($Email)?>
  122. </span>
  123. <span class="float_right">
  124. <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
  125. title="History" class="brackets tooltip">H</a>
  126. <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>"
  127. title="Search" class="brackets tooltip">S</a>
  128. </span><br />
  129. <span class="float_left">
  130. <?=display_str($InviterEmail)?>
  131. </span>
  132. <span class="float_right">
  133. <a href="userhistory.php?action=email&amp;userid=<?=$InviterID?>"
  134. title="History" class="brackets tooltip">H</a>
  135. <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($InviterEmail)?>"
  136. title="Search" class="brackets tooltip">S</a>
  137. </span><br />
  138. </td>
  139. <td>
  140. <span class="float_left">
  141. <?=display_str($IP)?>
  142. </span>
  143. <span class="float_right">
  144. <?=display_str($Uses)?>
  145. <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>"
  146. title="History" class="brackets tooltip">H</a>
  147. <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>"
  148. title="Search" class="brackets tooltip">S</a>
  149. <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>"
  150. title="WI" class="brackets tooltip">WI</a>
  151. </span><br />
  152. <span class="float_left">
  153. <?=display_str($InviterIP)?>
  154. </span>
  155. <span class="float_right">
  156. <?=display_str($InviterUses)?>
  157. <a href="userhistory.php?action=ips&amp;userid=<?=$InviterID?>"
  158. title="History" class="brackets tooltip">H</a>
  159. <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($InviterIP)?>"
  160. title="Search" class="brackets tooltip">S</a>
  161. <a href="http://whatismyipaddress.com/ip/<?=display_str($InviterIP)?>"
  162. title="WI" class="brackets tooltip">WI</a>
  163. </span><br />
  164. </td>
  165. <td>
  166. <?=$IPCC?><br />
  167. <?=$InviterIPCC?>
  168. </td>
  169. <td>
  170. <?=Tools::get_host_by_ajax($IP)?><br />
  171. <?=Tools::get_host_by_ajax($InviterIP)?>
  172. </td>
  173. <td>
  174. <?=time_diff($Joined)?><br />
  175. <?=time_diff($InviterJoined)?>
  176. </td>
  177. </tr>
  178. <?php
  179. } ?>
  180. </table>
  181. <div class="linkbox">
  182. <?= $Pages; ?>
  183. </div>
  184. <?php
  185. } else { ?>
  186. <h2>There have been no new registrations in the past 72 hours.</h2>
  187. <?php
  188. }
  189. View::show_footer();