Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
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_image.php 841B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. require_once('../includes/config.php');
  3. //check to see that the form has been submitted
  4. $id = 0;
  5. if(isset($_POST) && $logged_in)
  6. {
  7. $id = rawurldecode($_POST['id']);
  8. $image = $db->select('ricehalla', "id=? LIMIT 1", array($id));
  9. if ($image)
  10. {
  11. $success = true;
  12. $userID = $image['user_id'];
  13. if($success && $user->id != $userID)
  14. {
  15. $error = "You are not allowed to delete this image.";
  16. $success = false;
  17. }
  18. if ($success)
  19. {
  20. $db->delete('ricehalla', 'id=?', array($id));
  21. $db->delete('votes', 'row_id=? AND table_name=?', array($id, 'ricehalla'));
  22. echo "true";
  23. }
  24. else
  25. {
  26. echo $error;
  27. }
  28. }
  29. else
  30. {
  31. echo "That image does not exist.";
  32. }
  33. }
  34. else
  35. {
  36. echo "You must be logged in to delete this image.";
  37. }
  38. ?>