diff --git a/account/register/register.php b/account/register/register.php
index 92045ec..f0a1b1c 100644
--- a/account/register/register.php
+++ b/account/register/register.php
@@ -98,7 +98,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
echo "
Rôle : " . $role . "
";
?>
Aucun utilisateur n\'a été ajouté.";
diff --git a/admin/index.php b/admin/index.php
index 6a55e28..832a6a9 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,5 +1,6 @@
Panel d'administration
Vous êtes connecté en tant qu'administrateur.";
- }
- } else {
- include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
+ if (!isset($_COOKIE['userData'])) {
+ echo "
Vous n'êtes pas autorisé à accéder à cette page.
";
+ echo "
Redirection vers l'accueil dans 5 secondes...
";
+ header("refresh:5; url=/");
+ die();
+ }
- die("
Vous n'êtes pas autorisé à accéder à cette page.
");
+ $role = $userData['role'];
+ if ($role != 'Administrateur') {
+ echo "
Vous n'êtes pas autorisé à accéder à cette page.
";
+ echo "
Redirection vers l'accueil dans 5 secondes...
";
+ header("refresh:5; url=/");
+ die();
+ } else { // Si l'utilisateur est un administrateur : accès à la page
+ echo "
Bienvenue sur le panneau d'administration du site.
";
+ echo "
Vous pouvez ici gérer les utilisateurs.
";
+ echo "
Que souhaitez-vous faire ?
";
+ //contenu de la page admin
} ?>
-
-
-