From f1b1297804a8be1cf09f7a52812b02adc3b4c504 Mon Sep 17 00:00:00 2001 From: thomas Date: Wed, 12 Nov 2025 11:47:10 +0100 Subject: [PATCH] verlanglijstje --- whishlist.php | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 whishlist.php diff --git a/whishlist.php b/whishlist.php new file mode 100644 index 0000000..dd0d0fe --- /dev/null +++ b/whishlist.php @@ -0,0 +1,87 @@ +prepare("DELETE FROM wishlist WHERE id = ? AND username = ?"); + $stmt->execute([$_POST['delete'], $username]); + log_action($pdo, $username, 'Wishlist item verwijderd', 'Wishlist script'); + $message = "Item verwijderd!"; +} + +// Opslaan/updaten +if (isset($_POST['save'])) { + $content = $_POST['content'] ?? ''; + // Check of er al een wishlist is voor deze gebruiker + $stmt = $pdo->prepare("SELECT id FROM wishlist WHERE username = ?"); + $stmt->execute([$username]); + if ($stmt->rowCount() > 0) { + $row = $stmt->fetch(); + $stmtUpdate = $pdo->prepare("UPDATE wishlist SET content = ? WHERE id = ?"); + $stmtUpdate->execute([$content, $row['id']]); + log_action($pdo, $username, 'Wishlist geüpdatet', 'Wishlist script'); + $message = "Wishlist geüpdatet!"; + } else { + $stmtInsert = $pdo->prepare("INSERT INTO wishlist (username, content) VALUES (?, ?)"); + $stmtInsert->execute([$username, $content]); + log_action($pdo, $username, 'Wishlist aangemaakt', 'Wishlist script'); + $message = "Wishlist aangemaakt!"; + } +} + +// Huidige wishlist ophalen +$stmt = $pdo->prepare("SELECT * FROM wishlist WHERE username = ?"); +$stmt->execute([$username]); +$wishlist = $stmt->fetch(PDO::FETCH_ASSOC); +$content = $wishlist['content'] ?? ''; + +?> + + + + +Verlanglijstje + + + + + +

Verlanglijstje van

+ + +

+ + +
+
+ +
+ + +
+ +
+ + + +