Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
session_start();
require 'config.php';
include_once "class/class.php";
// Controleer of de gebruiker is ingelogd als admin
if (!isset($_SESSION['admin_logged_in'])) {
header('Location: admin_login.php');
exit;
}
functions::deleteVilla();
// Haal alle villa's op
$sql = "SELECT * FROM villas";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$villas = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Villa's Beheren</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="villa-management-page">
<div class="villa-management-container">
<h1>Villa's Beheren</h1>
<table>
<tr>
<th>ID</th>
<th>Naam</th>
<th>Beschrijving</th>
<th>Liggingen</th>
<th>Prijs</th>
<th>Afbeelding</th>
<th>Acties</th>
</tr>
<?php foreach ($villas as $villa): ?>
<tr>
<td><?php echo $villa['id']; ?></td>
<td><?php echo $villa['name']; ?></td>
<td><?php echo $villa['description']; ?></td>
<td><?php echo $villa['liggingen']; ?></td>
<td><?php echo $villa['price']; ?> EUR</td>
<td><img src="<?php echo $villa['image']; ?>" alt="<?php echo $villa['name']; ?>" width="100"></td>
<td>
<a href="edit_villa.php?id=<?php echo $villa['id']; ?>" class="btn">Bewerken</a>
<a href="villa_management.php?delete=<?php echo $villa['id']; ?>" class="btn-delete" onclick="return confirm('Weet je zeker dat je deze villa wilt verwijderen?')">Verwijderen</a>
</td>
</tr>
<?php endforeach; ?>
</table>
<a href="admin.php" class="btn-back">Terug naar Dashboard</a>
</div>
</div>
</body>
</html>