Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
113 lines (87 loc) · 2.71 KB
/
Copy pathindex.php
File metadata and controls
113 lines (87 loc) · 2.71 KB
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
<?php
define('BASE_PATH', '/volontario');
define('ROOT_PATH', __DIR__);
ini_set('display_errors', 0);
ini_set('log_errors', 1);
error_reporting(E_ALL);
ini_set('session.use_strict_mode', 1);
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_samesite', 'Lax');
ini_set('session.cookie_secure', !empty($_SERVER['HTTPS']) ? 1 : 0);
set_exception_handler(function ($e) {
error_log($e);
if (!headers_sent()) {
http_response_code(500);
}
include ROOT_PATH . '/php/error_500.php';
});
require_once ROOT_PATH . '/db/include/functions.php';
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (BASE_PATH !== '/' && strpos($path, BASE_PATH) === 0) {
$path = substr($path, strlen(BASE_PATH));
}
$path = rtrim($path, '/');
if ($path === '') { $path = '/'; }
// Se il file esiste fisicamente (es. un'immagine o un CSS), lascia che il server lo serva
if ((strpos($path, '/src/') === 0 || $path === '/db/include/comuni.php') && is_file(ROOT_PATH . $path)) {
return false;
}
switch ($path) {
case '/':
include ROOT_PATH . '/php/home.php';
break;
case '/register':
include ROOT_PATH . '/php/register.php';
break;
case '/login':
include ROOT_PATH . '/php/login.php';
break;
case '/come-funziona':
include ROOT_PATH . '/php/come_funziona.php';
break;
case '/logout':
include ROOT_PATH . '/php/logout.php';
break;
case '/profilo':
include ROOT_PATH . '/php/profilo.php';
break;
case '/recensioni':
include ROOT_PATH . '/php/recensioni.php';
break;
case '/richieste':
include ROOT_PATH . '/php/richieste.php';
break;
case '/candidature':
include ROOT_PATH . '/php/candidature.php';
break;
case '/bacheca-richieste':
include ROOT_PATH . '/php/bacheca.php';
break;
case '/come-funziona':
include ROOT_PATH . '/php/come_funziona.php';
break;
case '/nuova-richiesta':
include ROOT_PATH . '/php/nuova-richiesta.php';
break;
case '/modifica-profilo':
include ROOT_PATH . '/php/modificaProfilo.php';
break;
case '/pannello':
include ROOT_PATH . '/php/pannello.php';
break;
case '/error-500':
http_response_code(500);
include ROOT_PATH . '/php/error_500.php';
break;
case '/nuova-recensione':
include ROOT_PATH . '/php/nuovaRecensione.php';
break;
case '/modifica-richiesta':
include ROOT_PATH . '/php/modifica-richiesta.php';
break;
default:
http_response_code(404);
include ROOT_PATH . '/php/error_404.php';
break;
}
?>