-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (33 loc) · 813 Bytes
/
Copy pathindex.php
File metadata and controls
40 lines (33 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include_once("inc/autoload.php");
requireLogin(); // Redirects if not logged in
?>
<!doctype html>
<html lang="en">
<head>
<?php include_once("inc/html_head.php"); ?>
</head>
<body>
<?php include_once("inc/view_navbar.php"); ?>
<div class="container my-5">
<?php
if ($user->isLoggedIn()) {
$requestedPage = $_GET['page'] ?? 'index';
if (!preg_match('/^[A-Za-z0-9_-]+$/', $requestedPage)) {
$requestedPage = '404';
}
} else {
$requestedPage = 'logon';
}
$pagePath = __DIR__ . "/pages/{$requestedPage}.php";
// Fallback if file doesn’t exist
if (!file_exists($pagePath)) {
$pagePath = __DIR__ . "/pages/404.php";
}
include_once($pagePath);
include_once("inc/view_footer.php");
?>
</div>
<script src="js/main.js"></script>
</body>
</html>