From 482f7888d2ce537cae2f8938e4bec3d52d0c2ba3 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 5 Jul 2016 15:21:32 +0200 Subject: [PATCH] =?UTF-8?q?Gestion=20de=20la=20r=C3=A9cup=C3=A9ration=20de?= =?UTF-8?q?s=20informations=20du=20'warehouse'=20et=20de=20l'=20'admin'=20?= =?UTF-8?q?quand=20on=20a=20le=20token=20correspondant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/Authentification.php | 13 +++++++++++++ test/authTest.php | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/manager/Authentification.php b/manager/Authentification.php index 08c15b0..9bd8776 100644 --- a/manager/Authentification.php +++ b/manager/Authentification.php @@ -81,6 +81,12 @@ // Si le token n'existe pas if( count($checkRoot->answer()) < 1 ) return false; + + // On met à jour les informations + $_SESSION['WAREHOUSE'] = [ + 'id' => $checkRoot->answer()[0]['id_warehouse'], + 'name' => $checkRoot->answer()[0]['name'] + ]; } /* [3] Si authentification double @@ -91,6 +97,13 @@ // Si le token n'existe pas if( count($checkBranch->answer()) < 1 ) return false; + + // On met à jour les informations + $_SESSION['ADMIN'] = [ + 'id' => $checkBranch->answer()[0]['id_admin'], + 'username' => $checkBranch->answer()[0]['username'], + 'mail' => $checkBranch->answer()[0]['mail'] + ]; } /* [4] Si pas d'erreur d'authentification, on retourne TRUE diff --git a/test/authTest.php b/test/authTest.php index b6b14fb..dfaa4d5 100644 --- a/test/authTest.php +++ b/test/authTest.php @@ -4,7 +4,8 @@ use \manager\Authentification; - var_dump($_SESSION['AUTH']); var_dump( Authentification::auth() ); + var_dump( $_SESSION ); + ?>