<?php
require_once 'init.php';

$connected = "false";

if (!isset($_GET["page"])) {
    header("Location: ?page=home");
    exit;
}

$page = sanitizeInput($_GET["page"]);

// Vérifier l'authentification
if (isAuthenticated()) {
	$admin = array(
		"username" => $_SESSION['username']
	);
	$connected = "true";
} else {
    $page = "login";
}

?>
<!doctype html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../Static/css/admin.css">
    <script type="module" src="../Static/js/admin.js" defer></script>
    <title>Administration</title>
</head>
<body<?= ($page == "login") ? " class='login-page'" : "" ?>>
    <?php require_once $page.".php" ?>
</body>
</html>