diff --git a/authentication.php b/authentication.php index b3616db..ccafadc 100644 --- a/authentication.php +++ b/authentication.php @@ -84,7 +84,7 @@ class authentication */ public function logout ($url = "") { - if (! isset ($_SESSION)) + if (session_id () === "") session_start (); if ($this->debug) echo "
LOGOUT\n";
     $authsession = new \authsession ();
@@ -114,7 +114,7 @@ class authentication
   public function pageHTML ($url = "")
   {
     // If the user is already connected, redirect to the main page of the site
-    if (! isset ($_SESSION))
+    if (session_id () === "")
       session_start ();
     $auth = new \auth ();
     $pre = new \authparams (array ("session"));
@@ -138,7 +138,7 @@ class authentication
     */
   public function verifAuthLoginPage ($url = "")
   {
-    if (! isset ($_SESSION))
+    if (session_id () === "")
       session_start ();
     if ($this->debug) echo "Call verifAuthLoginPage ($url) : Start\n";
     // rate-limit the connections
@@ -365,7 +365,7 @@ class authentication
     $this->route
     ->get ("authentication/logout({url})?", function ($url) use ($authObj)
     {
-      if (! isset ($_SESSION))
+      if (session_id () === "")
         session_start ();
       $authObj->logout ($url);
     })
@@ -377,7 +377,7 @@ class authentication
 
     ->get ("authentication/({url})?", function ($url) use ($authObj)
     {
-      if (! isset ($_SESSION))
+      if (session_id () === "")
         session_start ();
       $authObj->pageHTML ($url);
       exit;
@@ -385,7 +385,7 @@ class authentication
 
     ->post ("authentication/({url})?", function ($url) use ($authObj)
     {
-      if (! isset ($_SESSION))
+      if (session_id () === "")
         session_start ();
       $authObj->verifAuthLoginPage ($url);
       exit;