2024-06-10 23:23:51 +02:00
|
|
|
<?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'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
<nav class="menu-container">
|
|
|
|
<!-- burger menu -->
|
|
|
|
<input type="checkbox" aria-label="Toggle menu" />
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
|
|
|
|
<!-- logo -->
|
2024-06-09 17:07:43 +02:00
|
|
|
<a href="../../../" class="menu-logo">
|
2024-05-28 15:40:57 +02:00
|
|
|
<img src="https://i.imgur.com/RkmSo9Q.png" alt="Jeux Olympiques - Paris 2024" />
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<!-- menu items -->
|
|
|
|
<div class="menu">
|
|
|
|
<ul>
|
2024-06-11 10:56:40 +02:00
|
|
|
<li><?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
$role = $userData['role'];
|
|
|
|
if ($role == 'Administrateur') {
|
|
|
|
echo "<a href='/admin'>Panel d'administration</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?></li>
|
2024-05-28 15:40:57 +02:00
|
|
|
<li>
|
|
|
|
<a href="/events">
|
|
|
|
Évènements
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2024-06-10 23:23:51 +02:00
|
|
|
<?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
echo "<a href='/account/profile'>Mon profil</a>";
|
|
|
|
} else {
|
|
|
|
echo "<a href='/account/login'>Connexion</a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2024-06-09 15:59:07 +02:00
|
|
|
<!-- script php qui vérifie le cookie. Si cookie, propose déconnexion, si pas cookie propose connexion -->
|
2024-05-28 15:40:57 +02:00
|
|
|
</li>
|
2024-06-11 10:56:40 +02:00
|
|
|
<li><?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
echo "<a href='/tools/logout.php'>Déconnexion</a>";
|
|
|
|
}
|
|
|
|
?></li>
|
2024-05-28 15:40:57 +02:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</nav>
|