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_ip.php 1.6KB

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