-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
80 lines (66 loc) · 1.42 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
<?php
function getPath($page) {
require __DIR__ . "/views/pages/".$page.".php";
}
function getAction($page) {
require __DIR__ . "/controllers/".$page.".php";
}
if (!isset($_GET["c"])) {
header('Location: ?c=home');
}
function secureUrl($url) {
$url = strip_tags($url);
$url = trim($url);
$url = htmlspecialchars($url);
return $url;
}
$c = secureUrl($_GET['c']);
switch ($c) {
case 'home':
getPath("index");
break;
case 'pokemon':
getPath("show");
break;
case 'login':
getPath("login");
break;
case 'logout':
getPath("logout");
break;
case 'register':
getPath("register");
break;
case 'search':
getPath("search");
break;
case 'adminPanel':
getPath("adminPanel");
break;
case 'collection':
getPath("collection");
break;
case 'connect':
require __DIR__ . "./controllers/loginController.php";
break;
default:
require __DIR__ . "/views/errors/404.php";
break;
}
if (isset($_GET['a'])) {
$a = secureUrl($_GET["a"]);
switch ($a) {
case 'connect':
getAction("loginController");
break;
case 'register':
getAction("RegisterController");
break;
case 'edit':
getAction("editController");
break;
default:
getPath("404");
break;
}
}