-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
124 lines (109 loc) · 3.19 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
123
124
<?php
session_start();
require_once 'src/db.class.php';
require __DIR__ . '/vendor/autoload.php';
$router = new \Bramus\Router\Router();
//main page-landing-page generic
$router->match('GET|POST', '/', function() {
require_once("src/index.php");
});
//faq
$router->match('GET|POST', '/faq', function() {
require_once("src/faq.php");
});
//terms
$router->match('GET|POST', '/terms', function() {
require_once("src/terms.php");
});
//login
$router->match('GET|POST', '/register', function() {
require_once("src/register.php");
});
//register
$router->match('GET|POST', '/login', function() {
require_once("src/login.php");
});
//privacy
$router->match('GET|POST', '/privacy', function() {
require_once("src/privacy.php");
});
//logout
$router->match('GET|POST', '/logout', function() {
session_destroy();
header("Location: /login");
});
#fuct
//forum
$router->match('GET|POST', '/i', function() {
require_once("src/app/index.php");
});
$router->match('GET|POST', '/add', function() {
require_once("src/app/add.php");
});
/////////////////////////////////////////////////////////////////////
//admin panel
$router->match('GET|POST', '/admin', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/index.php");
}else{
require_once("src/admin/index.php");
}
});
//team
$router->match('GET|POST', '/admin/team', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/UserFuct/team.php");
}else{
require_once("src/admin/index.php");
}
});
//settings
$router->match('GET|POST', '/admin/settings', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/UserFuct/settings.php");
}else{
require_once("src/admin/index.php");
}
});
//adduser
$router->match('GET|POST', '/admin/adduser', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/UserFuct/adduser.php");
}else{
require_once("src/admin/index.php");
}
});
//manage
$router->match('GET|POST', '/admin/manage', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/UserFuct/manage.php");
}else{
require_once("src/admin/index.php");
}
});
//edit profile
$router->match('GET|POST', '/admin/edit', function() {
if (isset($_SESSION['user-admin'])) {
include("src/admin/panel/UserFuct/edit.php");
}else{
require_once("src/admin/index.php");
}
});
//upload
////////////////////////////////////////////////////////////////////////////////////
//post
$router->match('GET|POST', '/i/{sub}/{postid}', function($sub,$postid) {
$row = DB::queryFirstRow("SELECT name, des, text,data,user,up FROM post WHERE id=%s LIMIT 1", $postid);
include("src/app/post.php");
});
//user
$router->get('/u/(\w+)', function($name) {
$row = DB::queryFirstRow("SELECT username, date, email,data FROM users WHERE username=%s LIMIT 1", $name);
if($row==NULL){
include ('src/app/no_user.php');}
else{
include ('src/app/user.php');
}});
// Run it!
$router->run();
?>