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.

take_delete_email.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. enforce_login();
  3. authorize();
  4. if (!isset($_POST['emails']) || !is_array($_POST['emails'])) {
  5. error('Stop that.');
  6. }
  7. if (!apcu_exists('DBKEY')) {
  8. error(403);
  9. }
  10. $EncEmails = $_POST['emails'];
  11. $Reason = $_POST['reason'] ?? '';
  12. foreach ($EncEmails as $EncEmail) {
  13. $DB->query("
  14. SELECT
  15. `UserID`
  16. FROM
  17. `users_history_emails`
  18. WHERE
  19. `Email` = '".db_string($EncEmail)."'
  20. ");
  21. if (!$DB->has_results()) {
  22. error('Email not found');
  23. }
  24. list($UserID) = $DB->next_record();
  25. if (!check_perms('users_mod') && ($UserID !== $LoggedUser['ID'])) {
  26. error(403);
  27. }
  28. $DB->query("
  29. SELECT
  30. `Email`
  31. FROM
  32. `users_main`
  33. WHERE
  34. `ID` = '$UserID'
  35. ");
  36. if (!$DB->has_results()) {
  37. error(404);
  38. }
  39. list($Curr) = $DB->next_record();
  40. $Curr = Crypto::decrypt($Curr);
  41. if ($Curr === Crypto::decrypt($EncEmail)) {
  42. error("You can't delete your current email.");
  43. }
  44. }
  45. // Okay I think everything checks out.
  46. $DB->query("
  47. INSERT INTO `deletion_requests`(
  48. `UserID`,
  49. `Type`,
  50. `Value`,
  51. `Reason`,
  52. `Time`
  53. )
  54. VALUES(
  55. '$UserID',
  56. 'Email',
  57. '".db_string($EncEmails[0])."',
  58. '".db_string($Reason)."',
  59. NOW())
  60. ");
  61. $Cache->delete_value('num_deletion_requests');
  62. View::show_header('Email Deletion Request');
  63. ?>
  64. <div>
  65. <h2>Email Deletion Request</h2>
  66. <div class="box">
  67. <p>
  68. Your request has been sent.
  69. Please wait for it to be acknowledged.
  70. </p>
  71. <p>
  72. After it's accepted or denied by staff, you will receive a PM response.
  73. </p>
  74. <p>
  75. <a href="/index.php">Return</a>
  76. </p>
  77. </div>
  78. </div>
  79. <?php
  80. View::show_footer();