forked from ronmarasigan/PIP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
50 lines (42 loc) · 1.51 KB
/
index.php
File metadata and controls
50 lines (42 loc) · 1.51 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
<?php
// Base paths
define('ROOT_DIR', realpath(dirname(__FILE__)) .'/');
define('APP_DIR', ROOT_DIR .'application/');
require(ROOT_DIR .'system/config.php');
// Settings
global $config;
define('BASE_URL', $config['base_url']);
/* Secure session (disabled as it does not function as intended, will be fixed in time)
if(session_id() == '' || !isset($_SESSION)) {
session_name($config['session_name']);
session_set_cookie_params($lifetime = $config['cookie_lifetime'], $secure = $config['https_cookie'], $http_only = $config['http_only']);
session_start();
} else {
session_start();
} */
// Start a session
session_start();
// Set variable for tracking the number of requests per session id
if(!isset($_SESSION['regen'])) {
$_SESSION['regen'] = 0;
}
// Rotate session id every N requests to protect from session fixation
if(++$_SESSION['regen'] > $config['rotation_interval']) {
$_SESSION['regen'] = 0;
session_regenerate_id(true);
}
// PHP settings for dev mode
if(!$config['production']) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('memory_limit', '-1');
set_time_limit(0);
}
// Base classes for application
require(ROOT_DIR .'system/model.php');
require(ROOT_DIR .'system/view.php');
require(ROOT_DIR .'system/controller.php');
require(ROOT_DIR .'system/pip.php');
// Call PIP
pip();
?>