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.

invite_pool.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. #declare(strict_types=1);
  3. if (!check_perms('users_view_invites')) {
  4. error(403);
  5. }
  6. $Title = 'Invite Pool';
  7. View::show_header($Title);
  8. define('INVITES_PER_PAGE', 50);
  9. list($Page, $Limit) = Format::page_limit(INVITES_PER_PAGE);
  10. if (!empty($_POST['invitekey']) && check_perms('users_edit_invites')) {
  11. authorize();
  12. $DB->query("
  13. DELETE FROM invites
  14. WHERE InviteKey = '".db_string($_POST['invitekey'])."'");
  15. }
  16. if (!empty($_GET['search'])) {
  17. $Search = db_string($_GET['search']);
  18. } else {
  19. $Search = '';
  20. }
  21. $sql = "
  22. SELECT
  23. SQL_CALC_FOUND_ROWS
  24. um.ID,
  25. um.IP,
  26. i.InviteKey,
  27. i.Expires,
  28. i.Email
  29. FROM invites AS i
  30. JOIN users_main AS um ON um.ID = i.InviterID ";
  31. if ($Search) {
  32. $sql .= "
  33. WHERE i.Email LIKE '%$Search%' ";
  34. }
  35. $sql .= "
  36. ORDER BY i.Expires DESC
  37. LIMIT $Limit";
  38. $RS = $DB->query($sql);
  39. $DB->query('SELECT FOUND_ROWS()');
  40. list($Results) = $DB->next_record();
  41. $DB->set_query_id($RS);
  42. ?>
  43. <div class="header">
  44. <h2>
  45. <?=$Title?>
  46. </h2>
  47. </div>
  48. <div class="box pad">
  49. <p>
  50. <?=number_format($Results)?> unused invites have been sent.
  51. </p>
  52. </div>
  53. <br />
  54. <div>
  55. <form class="search_form" name="invites" action="" method="get">
  56. <table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
  57. <tr>
  58. <td class="label">
  59. <strong>Email address:</strong>
  60. </td>
  61. <td>
  62. <input type="hidden" name="action" value="invite_pool" />
  63. <input type="email" name="search" size="60"
  64. value="<?=display_str($Search)?>" />
  65. &nbsp;
  66. <input type="submit" value="Search log" />
  67. </td>
  68. </tr>
  69. </table>
  70. </form>
  71. </div>
  72. <div class="linkbox">
  73. <?php
  74. $Pages = Format::get_pages($Page, $Results, INVITES_PER_PAGE, 11) ;
  75. echo $Pages;
  76. ?>
  77. </div>
  78. <table width="100%">
  79. <tr class="colhead">
  80. <td>Inviter</td>
  81. <td>Email address</td>
  82. <td>IP address</td>
  83. <td>InviteCode</td>
  84. <td>Expires</td>
  85. <?php if (check_perms('users_edit_invites')) { ?>
  86. <td>Controls</td>
  87. <?php } ?>
  88. </tr>
  89. <?php
  90. while (list($UserID, $IP, $InviteKey, $Expires, $Email) = $DB->next_record()) {
  91. $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
  92. $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'; ?>
  93. <tr class="row">
  94. <td>
  95. <?=Users::format_username($UserID, true, true, true, true)?>
  96. </td>
  97. <td>
  98. <?=display_str($Email)?>
  99. </td>
  100. <td>
  101. <?=Tools::display_ip($IP)?>
  102. </td>
  103. <td>
  104. <?=display_str($InviteKey)?>
  105. </td>
  106. <td>
  107. <?=time_diff($Expires)?>
  108. </td>
  109. <?php if (check_perms('users_edit_invites')) { ?>
  110. <td>
  111. <form class="delete_form" name="invite" action="" method="post">
  112. <input type="hidden" name="action" value="invite_pool" />
  113. <input type="hidden" name="auth"
  114. value="<?=$LoggedUser['AuthKey']?>" />
  115. <input type="hidden" name="invitekey"
  116. value="<?=display_str($InviteKey)?>" />
  117. <input type="submit" value="Delete" />
  118. </form>
  119. </td>
  120. <?php } ?>
  121. </tr>
  122. <?php
  123. } ?>
  124. </table>
  125. <?php if ($Pages) { ?>
  126. <div class="linkbox pager"><?=($Pages)?>
  127. </div>
  128. <?php }
  129. View::show_footer();