-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
87 lines (74 loc) · 2.38 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
<?php
include_once("controller/session_ctrl.php");
include_once("controller/tor_detection.php");
if(TorDetection::isExitNode()) {
http_response_code(403);
return;
}
$view = "home";
$title = "QLBase | Home";
$sess_id = isset($_COOKIE["sess_id"]) ? $_COOKIE["sess_id"] : "";
function getPage($viewName, $pageTitle) {
global $view;
global $title;
$view = $viewName;
$title = "QLBase | ".$pageTitle;
}
function defaultPage() {
getPage("home", "Home");
}
function sessionCleanUp() {
if(isset($_COOKIE["sess_id"]) && !empty($_COOKIE["sess_id"]))
SessionControl::delete();
}
if(isset($_COOKIE["sess_id"]) &&
!empty($_COOKIE["sess_id"]) &&
SessionControl::validate($sess_id)) {
if(isset($_GET["page"]) && !empty($_GET["page"]))
switch($_GET["page"]) {
case "settings":
getPage("settings", "Settings");
break;
case "app":
getPage("app", "App");
break;
default:
getPage("dashboard", "Dashboard");
break;
}
else getPage("dashboard", "Dashboard");
}
else if(isset($_GET["page"]) && !empty($_GET["page"])) {
$page = $_GET["page"];
sessionCleanUp();
if($page == "sign-up")
getPage("sign-up", "Sign-up");
else if($page == "log-in")
getPage("log-in", "Log-in");
else if($page == "recover")
getPage("recover", "Recover");
else if($page == "forgot")
getPage("forgot", "Forgot Your Password");
else defaultPage();
}
else {
sessionCleanUp();
defaultPage();
}
?>
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<meta name="description" content="QLBase" />
<meta name="keywords" content="nthnn" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php echo $title; ?></title>
<link href="./styles/global.css" rel="stylesheet" />
<link href="./styles/timeline.css" rel="stylesheet" />
<link href="./styles/bootstrap.min.css" rel="stylesheet" />
<link href="./favicon.ico" rel="shortcut icon" />
</head>
<body>
<?php require_once("views/".$view.".php"); ?>
</body>
</html>