This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
122 lines (105 loc) · 3.92 KB
/
index.php
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php include "./handlers/index.php" ?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pâle Emploi</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<style>
table,
th,
td {
border: 1px solid black;
}
table {
border-collapse: collapse;
}
* {
font-family: Arial, Helvetica, sans-serif;
}
main > .container {
padding: 100px 15px 0;
}
:root {
--bs-dark-rgb: 0, 0, 0;
}
</style>
</head>
<body class="d-flex flex-column vh-100 bg-light">
<?php include "./pages/partials/header.php"; ?>
<main class="flex-shrink-0">
<?php
try {
if (isset($_GET["page"])) {
$page = $_GET["page"];
if (str_ends_with($page, "/")) {
$page .= "index";
}
$extension = pathinfo($page, PATHINFO_EXTENSION);
$path_to_page = "./pages/$page";
if (empty($extension)) {
$path_to_page .= ".php";
}
if (file_exists($path_to_page)) {
if (str_ends_with($path_to_page, ".php")) {
include $path_to_page;
} else {
redirect_to($path_to_page);
}
} else {
include "./pages/404.php";
}
} else {
echo "<div class=\"container text-center\">
<h2>Bienvenue sur Pâle Emploi!</h2>
<div>
<p>Si vous avez déjà un compte, <a href=\"/?page=login\">connectez-vous</a>.</p>
<p>Si vous n'avez pas de compte, <a href=\"/?page=register\">inscrivez-vous</a>.</p>
</div>
<img src=\"/assets/img/logo.jpg\" alt=\"steghide\" width=\"300\" />
</div>";
}
} catch (Exception $e) {
redirect_to("/?page=error&error=" . urlencode($e->getMessage()));
}
?>
</main>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<?php
if (isset($_GET['message'])) {
$toast = $_GET['message'];
echo <<<HTML
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<img src="/assets/img/logo.jpg" class="rounded me-2" alt="steghide" width="32" height="32">
<strong class="me-auto">Message du système</strong>
<small>Maintenant</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Fermer la pop-up"></button>
</div>
<div class="toast-body">
$toast
</div>
</div>
HTML;
}
?>
</div>
<?php include "./pages/partials/footer.php"; ?>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+"
crossorigin="anonymous"></script>
<script>
const toastElList = document.querySelectorAll('.toast')
const toastList = [...toastElList].map(toastEl => new bootstrap.Toast(toastEl))
toastList.forEach(toast => toast.show())
</script>
</body>
</html>