-
Notifications
You must be signed in to change notification settings - Fork 4
/
initialize.php
53 lines (37 loc) · 1.27 KB
/
initialize.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
<?php
// Uncomment for debug mode
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
error_reporting(0);
// Prevents javascript XSS attacks aimed to steal the session ID
ini_set('session.cookie_httponly', 1);
// Session ID cannot be passed through URLs
ini_set('session.use_only_cookies', 1);
// Uses a secure connection (HTTPS) if possible
ini_set('session.cookie_secure', 1);
// Same site cookie
ini_set('session.cookie_samesite', 'Lax');
// Make sure cookie works also on subdomains (e.g. www.roaddanger.org & nl.roaddanger.org)
$domain = substr($_SERVER['SERVER_NAME'], strpos($_SERVER['SERVER_NAME'],"."),100);
ini_set('session.cookie_domain', $domain);
session_start();
date_default_timezone_set('Europe/Amsterdam');
setlocale(LC_MONETARY, 'nl_NL');
mb_internal_encoding('UTF-8');
require_once __DIR__ . '/config.php';
require_once 'database.php';
require_once 'users.php';
require_once 'general/utils.php';
try {
$database = new Database();
try {
$database->open();
} catch (\Exception $e){
die('Internal error: Database connection failed');
}
$database->loadCountries();
$user = new User($database);
} catch (\Exception $e) {
$message = 'Internal error: Initialization failed: ' . $e->getMessage() . "\n\n" . $e->getTraceAsString();
die($message);
}