forked from cramblda/php-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·36 lines (28 loc) · 909 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
<?php
// Load bootstrap to apply configuration
include('config/bootstrap.php');
// Process URL into Application routing parameters
$route = new route();
// Start session to track user
session_start();
// User security check
defined('APP_AUTH_TYPE') or
die ("Configuration Setting: APP_AUTH_TYPE is not set.");
if ( 0 !== APP_AUTH_TYPE && !isset($_SESSION['username']) && 'auth' != $route->getController() ) {
$_SESSION = 0;
session_destroy();
session_start();
header ( 'Location: auth/login' );
}
// Route request to desired controller
switch ( $route->getController() ) {
case 'auth':
include( APP_CONTROLLER . '/authController.php');
break;
case 'home':
include( APP_CONTROLLER . '/homeController.php');
break;
default:
include( APP_CONTROLLER . '/homeController.php');
break;
}