From f8a510d190f19ca4d4053ff75f0c13b712485af8 Mon Sep 17 00:00:00 2001 From: AkisYTB3 Date: Tue, 23 Jan 2024 12:55:28 +0100 Subject: [PATCH] hopefully working now --- index.php | 17 +++++++++++++++-- pages/global/index.html | 2 -- pages/global/login.html | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) delete mode 100644 pages/global/index.html diff --git a/index.php b/index.php index 6b9507d..bb2525d 100644 --- a/index.php +++ b/index.php @@ -16,13 +16,24 @@ require_once 'config.php'; $paths_to_check = array(); - $page = basename($_SERVER['QUERY_STRING']); $nav = include_ob("$template_dir/navigation.html"); + +if($page_dir == "global") { + if(!file_exists("$page_dir/index.html")) { + $page_file = "$page_dir/login.html"; + } +} + if(empty($page)){ - $page = 'index'; + if(isset($_SESSION['user_id'])){ + $page = 'index'; + } + else{ + $page = 'login'; + } } // Check if user is logged in @@ -37,6 +48,8 @@ $paths_to_check[] = "pages/global"; $page_file = "$template_dir/404.html"; + + foreach($paths_to_check as $page_dir){ $page_file_tmp = "$page_dir/$page.html"; if(file_exists($page_file_tmp)){ diff --git a/pages/global/index.html b/pages/global/index.html deleted file mode 100644 index c8da1c4..0000000 --- a/pages/global/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -

Watch something

\ No newline at end of file diff --git a/pages/global/login.html b/pages/global/login.html index 1bfd368..1de577c 100644 --- a/pages/global/login.html +++ b/pages/global/login.html @@ -1,5 +1,6 @@