-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·40 lines (32 loc) · 844 Bytes
/
index.php
File metadata and controls
executable file
·40 lines (32 loc) · 844 Bytes
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
###############
# ENVIRONMENT #
###############
require_once(__DIR__ . '/descartes/load-environment.php');
###########
# ROUTING #
###########
require_once(PWD . '/routes.php'); //Include routes
############
# SESSIONS #
############
session_name(SESSION_NAME);
session_start();
//Create csrf token if it didn't exist
if (!isset($_SESSION['csrf']))
{
$_SESSION['csrf'] = str_shuffle(uniqid().uniqid());
}
##############
# INCLUDE #
##############
//Use autoload
require_once(PWD . '/descartes/autoload.php');
require_once(PWD . '/vendor/autoload.php');
#########
# MODEL #
#########
//Create new PDO instance
$pdo = Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
//Routing current query
Router::route(ROUTES, $_SERVER['REQUEST_URI'], $pdo);