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.

delete_invite.php 897B

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