From ee3f8867bf7818e152ccb8fe75de4699c3ca294d Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 28 Apr 2015 09:58:07 +0000 Subject: [PATCH] authsession : don't display warning if the information is not stored in the previous session git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2086 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authsession.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/authsession.php b/authsession.php index 41b1dff..b17c440 100644 --- a/authsession.php +++ b/authsession.php @@ -37,6 +37,10 @@ class authsession extends auth /** Return all the parameters recorded for the authenticate user */ public function getdetails () { + if (! isset ($_SESSION["domframework"]["auth"]["email"])) + return array ("lastname"=>"anonymous", + "firstname"=>"", + "email"=>"anonymous"); return array ("lastname"=>$_SESSION["domframework"]["auth"]["lastname"], "firstname"=>$_SESSION["domframework"]["auth"]["firstname"], "email"=>$_SESSION["domframework"]["auth"]["email"]); @@ -77,9 +81,13 @@ class authsession extends auth /** Remove the informations from the session */ public function logout () { - unset ($_SESSION["domframework"]["auth"]["lastname"]); - unset ($_SESSION["domframework"]["auth"]["firstname"]); - unset ($_SESSION["domframework"]["auth"]["email"]); - unset ($_SESSION["domframework"]["auth"]["password"]); + if (isset ($_SESSION["domframework"]["auth"]["lastname"])) + unset ($_SESSION["domframework"]["auth"]["lastname"]); + if (isset ($_SESSION["domframework"]["auth"]["firstname"])) + unset ($_SESSION["domframework"]["auth"]["firstname"]); + if (isset ($_SESSION["domframework"]["auth"]["email"])) + unset ($_SESSION["domframework"]["auth"]["email"]); + if (isset ($_SESSION["domframework"]["auth"]["password"])) + unset ($_SESSION["domframework"]["auth"]["password"]); } }