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

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