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.

delete_invite.php 951B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. authorize();
  4. $InviteKey = db_string($_GET['invite']);
  5. $DB->query("
  6. SELECT InviterID
  7. FROM invites
  8. WHERE InviteKey = ?", $InviteKey);
  9. list($UserID) = $DB->next_record();
  10. if (!$DB->has_results()) {
  11. error(404);
  12. }
  13. if ($UserID != $LoggedUser['ID'] && $LoggedUser['PermissionID'] != SYSOP) {
  14. error(403);
  15. }
  16. $DB->query("
  17. DELETE FROM invites
  18. WHERE InviteKey = ?", $InviteKey);
  19. if (!check_perms('site_send_unlimited_invites')) {
  20. $DB->query("
  21. SELECT Invites
  22. FROM users_main
  23. WHERE ID = ?
  24. LIMIT 1", $UserID);
  25. list($Invites) = $DB->next_record();
  26. if ($Invites < 10) {
  27. $DB->query("
  28. UPDATE users_main
  29. SET Invites = Invites + 1
  30. WHERE ID = ?", $UserID);
  31. $Cache->begin_transaction("user_info_heavy_$UserID");
  32. $Cache->update_row(false, ['Invites' => '+1']);
  33. $Cache->commit_transaction(0);
  34. }
  35. }
  36. header('Location: user.php?action=invite');