From 05f11a18cd3d641ef8b6f1c8f14f1906811cc64c Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Mon, 28 Nov 2022 16:54:28 +0100 Subject: [PATCH] Bugfix in deleting wishes --- add_item.php | 4 ++-- index.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/add_item.php b/add_item.php index 6ea35e6..f1cce9c 100644 --- a/add_item.php +++ b/add_item.php @@ -25,9 +25,9 @@ $headers = array_change_key_case(get_headers($ItemImage, 1), CASE_LOWER); if (strpos($headers['content-type'], 'image/') !== false) { $strippedimagepath = strtok($ItemImage, '?'); - $imageLocalLink = $imagedir . '/' . uniqid() . '.' . pathinfo($strippedimagepath, PATHINFO_EXTENSION); + $imageLocalLink = uniqid() . '.' . pathinfo($strippedimagepath, PATHINFO_EXTENSION); echo "ImageLink: " . $imageLocalLink; - file_put_contents($imageLocalLink, fopen($strippedimagepath, 'r')); + file_put_contents($imagedir . '/' . $imageLocalLink, fopen($strippedimagepath, 'r')); } else { echo "Link is Not an Image"; } diff --git a/index.php b/index.php index 98ad6d1..c6dfe69 100644 --- a/index.php +++ b/index.php @@ -146,7 +146,7 @@ if (isset($_POST['delete']) && $loggedin == true) { if ($result !== false && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { - unlink($row['image']); + unlink($imagedir . '/' . $row['image']); $WhishTitle = $row['title']; } } @@ -419,7 +419,7 @@ if (isset($_POST['delete']) && $loggedin == true) {