-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (32 loc) · 957 Bytes
/
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
<?php
session_start();
require_once("vendor/autoload.php");
$app = new \Slim\Slim();
$app->config('debug', true);
$app->get('/', function() {
// $sql = new \Dsprog\DB\Sql();
// $rows = $sql->select("SELECT * FROM tb_users");
// (new \Dsprog\Tools())->convertArraytoJson($rows);
$page = new \Dsprog\Page();
$page->setView('index');
});
$app->get('/admin', function() {
\Dsprog\Models\User::verifyLogin();
$admin = new \Dsprog\PageAdmin();
$admin->setView('index');
});
$app->get('/admin/login', function() {
$admin = new \Dsprog\PageAdmin(['header'=>false, 'footer'=>false]);
$admin->setView('login');
});
$app->post('/admin/login', function() {
\Dsprog\Models\User::login($_POST['deslogin'], $_POST['despassword']);
header('location: /admin');
exit;
});
$app->get('/admin/logout', function() {
\Dsprog\Models\User::logout();
header('location: /admin/login');
exit;
});
$app->run();