Loris BALOCCHI
b4a541eb8c
Modification des header&footer pour afficher le panel admin si connecté en tant qu'ADM
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
$userDataEncoded = $_COOKIE['userData'];
|
|
$userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif
|
|
|
|
$email = $userData['email'];
|
|
$name = $userData['name'];
|
|
$familyName = $userData['familyName'];
|
|
$role = $userData['role'];
|
|
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="stylesheet" href="styles/main.css" />
|
|
<link rel="stylesheet" href="styles/header.css" />
|
|
<link rel="stylesheet" href="styles/footer.css" />
|
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
|
|
|
<link rel="icon" type="image/png" sizes="32x32"
|
|
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
|
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
|
<title>Jeux Olympiques - Paris 2024</title>
|
|
</head>
|
|
|
|
<body>
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/header.php'; ?>
|
|
<h1>Panel d'administration</h1>
|
|
<?php
|
|
if (isset($_COOKIE['userData'])) {
|
|
$role = $userData['role'];
|
|
if ($role == 'Administrateur') {
|
|
echo "<p class='text'>Vous êtes connecté en tant qu'administrateur.</p>";
|
|
}
|
|
} else {
|
|
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
|
|
|
|
die("<p class='text'>Vous n'êtes pas autorisé à accéder à cette page.</p>");
|
|
} ?>
|
|
|
|
<!-- code de la page ici -->
|
|
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/footer.php'; ?>
|
|
</body>
|
|
|
|
</html>
|