From 820416dbde2a6b683c6cb74105defc83c1736986 Mon Sep 17 00:00:00 2001 From: jbousquie Date: Wed, 30 Nov 2016 09:34:19 +0100 Subject: [PATCH] fix Profil() --- admin/session.php | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/admin/session.php b/admin/session.php index a394c34..1806ec4 100644 --- a/admin/session.php +++ b/admin/session.php @@ -1,11 +1,16 @@ 0 function Profil($username) { global $administrateurs, $superviseurs; + global $roles, $niveaux, $lib_personnel; if (in_array($username, $administrateurs)) { - return 2; + return $niveaux[$roles[3]]; } elseif (in_array($username, $superviseurs)) { - return 1; + return $niveaux[$roles[2]]; } else { - return 0; + $compte = Compte($username); + if ($compte[2] == $lib_personnel) { + return $niveaux[$roles[1]]; + } + else + { + return $niveaux[$roles[0]]; + } } -} +}; + +// Fonction FiltreProfil() : redirige vers interdit.php si profil pas autorisé +function FiltreProfil($profil) { + if ($profil == 0) { + header('Location: interdit.php'); + exit(); + } + +}; + + ?> \ No newline at end of file