Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
session_start();
if (!$_SESSION['admin_logged_in']) {
header("Location: admin_login.php");
exit();
}
// Include database connection
require_once('connection.php');
if (isset($_GET['entry_id'])) {
$entry_id = $_GET['entry_id'];
try {
// Prepare and execute SQL statement to delete the entry with the given ID
$stmt = $pdo->prepare("DELETE FROM guestbook WHERE id = :entry_id");
$stmt->bindParam(':entry_id', $entry_id);
$stmt->execute();
// Redirect back to admin dashboard after deletion
header("Location: admin_dashboard.php");
exit();
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
} else {
// Handle case where entry ID is not provided
echo "Entry ID not provided.";
}
?>