]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Fix login bug where it wouldn't redirect to the login page if you weren't logged...
authorValerie Pond <redacted>
Fri, 20 Jan 2023 06:13:48 +0000 (06:13 +0000)
committerValerie Pond <redacted>
Fri, 20 Jan 2023 06:13:48 +0000 (06:13 +0000)
plugins/sql_auth/sql_auth.php

index 1b77ba9448b4509c134ca5df2b177ae67c5896ce..c2b009a0ea3f0067758a7ddc08981d039a327d99 100644 (file)
@@ -32,7 +32,6 @@ class sql_auth
 
        public static function add_navbar(&$pages)
        {
-               session_start();
                if (!unreal_get_current_user()->id)
                {
                        $pages = NULL;
@@ -47,14 +46,17 @@ class sql_auth
 
        public static function session_start($n)
        {
-               
-               if (!isset($_SESSION['id']))
+               do_log($_SESSION);
+               if (!isset($_SESSION['id']) || empty($_SESSION))
                {
                        $tok = split($_SERVER['SCRIPT_FILENAME'], "/");
                        if ($check = security_check() && $tok[count($tok) - 1] !== "error.php") {
                                header("Location: " . BASE_URL . "plugins/sql_auth/error.php");
                                die();
                        }
+                       session_destroy();
+                       header("Location: ".BASE_URL."plugins/sql_auth/login.php");
+                       die();
                }
                else
                {
@@ -64,6 +66,7 @@ class sql_auth
                                header("Location: ".BASE_URL."plugins/sql_auth/login.php");
                                die();
                        }
+                       session_start();
                }
        }