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"]); } }