-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
61 lines (55 loc) · 1.89 KB
/
index.php
File metadata and controls
61 lines (55 loc) · 1.89 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require_once './src/functions/session.php';
require_once './src/functions/router.php';
require_once './src/plugins/translate/define.php';
define('BASE_DIR', __DIR__);
define('DIRNAME', dirname(__DIR__));
?>
<!DOCTYPE html>
<html lang="<?php echo $lang ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $pageName; ?></title>
<link href="./assets/style/mystyle.css" rel="stylesheet">
</head>
<body>
<nav>
<?php
require_once "./src/templates/header.php"; ?>
</nav>
<div id="app-response">message</div>
<div class="app">
<?php
// Check if the requested route exists
if (array_key_exists(strtolower($url), array_map('strtolower', $routes))) {
// Check if the user is authorized to access the route
if (isAuthorized($url)) {
// Extract the id parameter
$id = isset($_GET['id']) ? $_GET['id'] : null;
// Include the corresponding file
include $routes[$url];
} else {
// Handle unauthorized access
http_response_code(403); // Forbidden
echo '403 - Forbidden! You do not have access to this page';
}
} else {
// Handle 404 - Route not found
http_response_code(404);
echo '404 - Not Found';
} ?>
</div>
<?php
require_once "./src/templates/footer.php";
?>
<script>
const urlParams = new URLSearchParams(window.location.search);
const siteLang = urlParams.get('lang');
</script>
<script src="./assets/scripts/header-scripts.js"></script>
<script src="./src/plugins/translate/getTranslations.js"></script>
<script src="./src/scripts/login-popup.js"></script>
<script src="./src/scripts/postDb.js"></script>
</body>
</html>