hopefully working now

This commit is contained in:
Richard Mikloš 2024-01-23 12:55:28 +01:00
parent 00f4d245ef
commit f8a510d190
3 changed files with 16 additions and 4 deletions

@ -16,13 +16,24 @@ require_once 'config.php';
$paths_to_check = array(); $paths_to_check = array();
$page = basename($_SERVER['QUERY_STRING']); $page = basename($_SERVER['QUERY_STRING']);
$nav = include_ob("$template_dir/navigation.html"); $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)){ if(empty($page)){
$page = 'index'; if(isset($_SESSION['user_id'])){
$page = 'index';
}
else{
$page = 'login';
}
} }
// Check if user is logged in // Check if user is logged in
@ -37,6 +48,8 @@ $paths_to_check[] = "pages/global";
$page_file = "$template_dir/404.html"; $page_file = "$template_dir/404.html";
foreach($paths_to_check as $page_dir){ foreach($paths_to_check as $page_dir){
$page_file_tmp = "$page_dir/$page.html"; $page_file_tmp = "$page_dir/$page.html";
if(file_exists($page_file_tmp)){ if(file_exists($page_file_tmp)){

@ -1,2 +0,0 @@
<!--PAGENAME=You dont have any rights-->
<h1>Watch something</h1>

@ -1,5 +1,6 @@
<?php <?php
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
global $mysqli;
// Handle login form submission // Handle login form submission
$email = $_POST['email']; $email = $_POST['email'];
$password = $_POST['password']; $password = $_POST['password'];