30
index.php
30
index.php
@@ -12,11 +12,31 @@ if (!isset($_SESSION['user_id'])) {
|
||||
$result = mysqli_query($mysqli, $query);
|
||||
$user = mysqli_fetch_assoc($result);
|
||||
|
||||
// Include the appropriate HTML based on user's status
|
||||
if ($user['isAdmin'] == 1) {
|
||||
include 'pages/index_admin.html'; // Custom HTML for Admin
|
||||
} else {
|
||||
include 'pages/index_user.html'; // Custom HTML for regular user
|
||||
|
||||
$page = basename($_SERVER['QUERY_STRING']);
|
||||
$nav = file_get_contents("$template_dir/navigation.html");
|
||||
|
||||
if(empty($page)){
|
||||
if ($user['isAdmin'] == 1) {
|
||||
$page = 'index_admin'; // Custom HTML for Admin
|
||||
} else {
|
||||
$page = 'index_user'; // Custom HTML for regular user
|
||||
}
|
||||
}
|
||||
|
||||
$page_file = "$page_dir/$page.html";
|
||||
|
||||
if (!file_exists($page_file)) {
|
||||
$page_file = "$template_dir/404.html";
|
||||
}
|
||||
ob_start();
|
||||
include $page_file;
|
||||
$page_data = ob_get_clean();
|
||||
|
||||
$page_data = str_replace("__NAV_TEMPLATE__", $nav, $page_data);
|
||||
|
||||
echo $page_data;
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user