From cf6e272d87b4100da5fb5b2f5e261d4cbce169d5 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Mon, 19 Sep 2022 15:06:47 +0200 Subject: [PATCH] moved NewItem Button to the MenuBar --- add_item.php | 7 ++++--- index.php | 22 +++------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/add_item.php b/add_item.php index ac25236..bb1d0c3 100644 --- a/add_item.php +++ b/add_item.php @@ -16,9 +16,10 @@ $ItemImage = $_POST['ItemImage']; $headers = get_headers($ItemImage, 1); if (strpos($headers['Content-Type'], 'image/') !== false) { - $imageLocalLink = 'data/images/' . uniqid() . '.' . pathinfo($ItemImage, PATHINFO_EXTENSION); + $strippedimagepath = strtok($ItemImage, '?'); + $imageLocalLink = 'data/images/' . uniqid() . '.' . pathinfo($strippedimagepath, PATHINFO_EXTENSION); echo "ImageLink: " . $imageLocalLink; - file_put_contents($imageLocalLink, fopen($ItemImage, 'r')); + file_put_contents($imageLocalLink, fopen($strippedimagepath, 'r')); } else { echo "Link is Not an Image"; } @@ -40,7 +41,7 @@ if (false === $stmt) { die('prepare() failed: ' . htmlspecialchars($mysqli->error)); } -$rc = $stmt->bind_param('ssssi', $ItemTitle, $ItemDescription, $imageLocalLink, $ItemImage, $ItemPriceCents); +$rc = $stmt->bind_param('ssssi', $ItemTitle, $ItemDescription, $ItemLink, $imageLocalLink, $ItemPriceCents); if (false === $rc) { die('bind_param() failed: ' . htmlspecialchars($stmt->error)); } diff --git a/index.php b/index.php index 3dee879..5190b39 100644 --- a/index.php +++ b/index.php @@ -40,6 +40,9 @@ include_once('config/config.php'); Simple Wishlist + @@ -78,25 +81,6 @@ include_once('config/config.php'); } ?> -
-
- - add new Item - + - - -
-
new Item
-

extend your wishlist by adding a new Item

-
-
- -
-
-
-
-
-