Oppaitime'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.

email_history_userview.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?
  2. $UserID = $_GET['userid'];
  3. if (!is_number($UserID)) {
  4. error(404);
  5. }
  6. $Self = ($UserID == $LoggedUser['ID']);
  7. if (!check_perms('users_mod') && !$Self) {
  8. error(403);
  9. }
  10. if (!apcu_exists('DBKEY')) {
  11. error('The site is currently running with partial database access. Please wait for staff to fully decrypt it');
  12. }
  13. $DB->query("
  14. SELECT DISTINCT Email
  15. FROM users_history_emails
  16. WHERE UserID = '$UserID'");
  17. $EncEmails = $DB->collect("Email");
  18. $Emails = [];
  19. foreach ($EncEmails as $Enc) {
  20. if (!isset($Emails[Crypto::decrypt($Enc)])) {
  21. $Emails[Crypto::decrypt($Enc)] = [];
  22. }
  23. $Emails[Crypto::decrypt($Enc)][] = $Enc;
  24. }
  25. $DB->query("
  26. SELECT Email
  27. FROM users_main
  28. WHERE ID = '$UserID'");
  29. list($Curr) = $DB->next_record();
  30. $Curr = Crypto::decrypt($Curr);
  31. if (!$Self) {
  32. $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");
  33. list($Username) = $DB->next_record();
  34. View::show_header("Email history for $Username");
  35. } else {
  36. View::show_header("Your email history");
  37. }
  38. ?>
  39. <div class="header">
  40. <? if ($Self) { ?>
  41. <h2>Your email history</h2>
  42. <? } else { ?>
  43. <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
  44. <? } ?>
  45. </div>
  46. <table class="alternate_rows" width="100%">
  47. <tr class="colhead">
  48. <td>Email</td>
  49. <td>Expunge</td>
  50. </tr>
  51. <? foreach ($Emails as $Email => $Encs) { ?>
  52. <tr class="row">
  53. <td><?=display_str($Email)?></td>
  54. <td>
  55. <? if ($Email != $Curr) { ?>
  56. <form action="delete.php" method="post">
  57. <input type="hidden" name="action" value="email">
  58. <? foreach ($Encs as $Enc) { ?>
  59. <input type="hidden" name="emails[]" value="<?=$Enc?>">
  60. <? } ?>
  61. <input type="submit" value="X">
  62. </form>
  63. <? } ?>
  64. </td>
  65. </tr>
  66. <? } ?>
  67. </table>
  68. <? View::show_footer(); ?>