2020-03-05 23:06:59 +01:00
|
|
|
<?php
|
|
|
|
|
2020-03-09 16:49:36 +01:00
|
|
|
include __DIR__ . '/../php/auth.php';
|
2020-03-05 23:06:59 +01:00
|
|
|
|
2020-03-09 16:49:36 +01:00
|
|
|
ob_start();
|
|
|
|
|
|
|
|
$url = $_SERVER['REQUEST_URI'];
|
2020-03-09 18:05:36 +01:00
|
|
|
$url = preg_replace('/\?.+\=.+/m', '', $url);
|
2020-03-09 16:49:36 +01:00
|
|
|
|
2020-03-09 19:09:41 +01:00
|
|
|
if ($url === '/' && !isAuthorized()) {
|
2020-03-05 23:06:59 +01:00
|
|
|
include __DIR__ . '/../templates/index.html.php';
|
2020-03-09 19:09:41 +01:00
|
|
|
} elseif ($url === '/' && isAuthorized()) {
|
|
|
|
header('Location: /dashboard');
|
|
|
|
} elseif ($url === '/login' && $_SERVER['REQUEST_METHOD'] === "GET" && !isAuthorized()) {
|
2020-03-09 16:49:36 +01:00
|
|
|
include __DIR__ . '/../templates/login.html.php';
|
2020-03-09 19:09:41 +01:00
|
|
|
} elseif ($url === '/login' && $_SERVER['REQUEST_METHOD'] === "GET" && isAuthorized()) {
|
|
|
|
header('Location: /dashboard');
|
2020-03-09 16:49:36 +01:00
|
|
|
} elseif ($url === '/login' && $_SERVER['REQUEST_METHOD'] === "POST") {
|
|
|
|
include __DIR__ . '/../php/login.php';
|
2020-03-09 19:09:41 +01:00
|
|
|
} elseif ($url === '/update' && $_SERVER['REQUEST_METHOD'] === "POST" && isAuthorized()) {
|
|
|
|
include __DIR__ . '/../php/update.php';
|
2020-03-09 16:49:36 +01:00
|
|
|
} elseif ($url === '/dashboard' && isAuthorized()) {
|
|
|
|
include __DIR__ . '/../templates/dashboard.html.php';
|
2020-03-12 18:10:22 +01:00
|
|
|
} elseif ($url === '/help') {
|
|
|
|
include __DIR__ . '/../templates/help.html.php';
|
2020-03-09 19:09:41 +01:00
|
|
|
} elseif ($url === '/logout') {
|
|
|
|
include __DIR__ . '/../php/logout.php';
|
2020-03-14 12:13:15 +01:00
|
|
|
} elseif ($url === '/delete' && isAuthorized()) {
|
|
|
|
include __DIR__ . '/../php/delete.php';
|
2020-03-15 19:58:08 +01:00
|
|
|
} else {
|
|
|
|
http_response_code(404);
|
|
|
|
include __DIR__ . '/../templates/404.html.php';
|
2020-03-09 16:49:36 +01:00
|
|
|
}
|
2020-03-05 23:06:59 +01:00
|
|
|
|
2020-03-09 16:49:36 +01:00
|
|
|
$output = ob_get_clean();
|
2020-03-05 23:06:59 +01:00
|
|
|
|
2020-03-09 16:49:36 +01:00
|
|
|
include __DIR__ . '/../templates/layout.html.php';
|