delete.php 499 B

123456789101112131415161718192021
  1. <?php
  2. require 'app.php';
  3. if (isset($_GET['uid']) and isset($_GET['type'])) {
  4. $uid = $_GET['uid'];
  5. $type = $_GET['type'];
  6. if (!hasPermission("delete.$type")) {
  7. die("Not enough permissions.");
  8. }
  9. $sql = "DELETE FROM $type WHERE UID='$uid'";
  10. if ($conn->query($sql)) {
  11. echo "Successfully deleted $type.";
  12. } else {
  13. echo "Error deleting record: " . $conn->lastErrorMsg();
  14. }
  15. echo $conn->lastErrorMsg();
  16. } else {
  17. echo 'Something went wrong! (No type or no UID provided.)';
  18. }
  19. ?>