Bugfix in deleting wishes

This commit is contained in:
2022-11-28 16:54:28 +01:00
parent 27ec06033a
commit 05f11a18cd
2 changed files with 4 additions and 4 deletions

View File

@@ -25,9 +25,9 @@ $headers = array_change_key_case(get_headers($ItemImage, 1), CASE_LOWER);
if (strpos($headers['content-type'], 'image/') !== false) { if (strpos($headers['content-type'], 'image/') !== false) {
$strippedimagepath = strtok($ItemImage, '?'); $strippedimagepath = strtok($ItemImage, '?');
$imageLocalLink = $imagedir . '/' . uniqid() . '.' . pathinfo($strippedimagepath, PATHINFO_EXTENSION); $imageLocalLink = uniqid() . '.' . pathinfo($strippedimagepath, PATHINFO_EXTENSION);
echo "ImageLink: " . $imageLocalLink; echo "ImageLink: " . $imageLocalLink;
file_put_contents($imageLocalLink, fopen($strippedimagepath, 'r')); file_put_contents($imagedir . '/' . $imageLocalLink, fopen($strippedimagepath, 'r'));
} else { } else {
echo "Link is Not an Image"; echo "Link is Not an Image";
} }

View File

@@ -146,7 +146,7 @@ if (isset($_POST['delete']) && $loggedin == true) {
if ($result !== false && $result->num_rows > 0) { if ($result !== false && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
unlink($row['image']); unlink($imagedir . '/' . $row['image']);
$WhishTitle = $row['title']; $WhishTitle = $row['title'];
} }
} }
@@ -419,7 +419,7 @@ if (isset($_POST['delete']) && $loggedin == true) {
<?php <?php
if ($loggedin == true) { if ($loggedin == true) {
echo (' echo ('
$(\'#deleteModal\').on(\'show.bs.modal\', function(event) \{ $(\'#deleteModal\').on(\'show.bs.modal\', function(event) {
var resTr = $(event.relatedTarget) var resTr = $(event.relatedTarget)
var whishcard = resTr.parents().closest(\'.card\'); var whishcard = resTr.parents().closest(\'.card\');
var whishtitle = whishcard.find(\'.card-title\').text(); var whishtitle = whishcard.find(\'.card-title\').text();