From 8fd771a3451adf2c37d241d7c65a75b59a934eba Mon Sep 17 00:00:00 2001 From: thaaoblues Date: Thu, 11 Apr 2024 22:11:19 +0200 Subject: [PATCH] phpcasss --- session_verif.php | 8 ++++++++ validation.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/session_verif.php b/session_verif.php index 4043e0d..00ccf48 100644 --- a/session_verif.php +++ b/session_verif.php @@ -41,6 +41,14 @@ function verifier_session(){ //return json_encode(["status"=>1,"msg"=>"Bonjour !"]); } +$ADMINS = array("mougnibas","rebillar"); + +function admin_seulement(){ + global $ADMINS; + if(!in_array(phpCAS::getUser(), $ADMINS)) { + header("Location: /index.php"); + } +} ?> \ No newline at end of file diff --git a/validation.php b/validation.php index 4e00d39..a46282c 100644 --- a/validation.php +++ b/validation.php @@ -14,6 +14,8 @@ include("test_creds.php"); $conn = new mysqli($servername, $username, $password,$dbname); +admin_seulement(); + // Function to fetch and display documents function generer_chronologie() {