-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·48 lines (28 loc) · 991 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
37
38
39
40
41
42
43
44
45
46
47
48
<?php
session_start();
require_once 'autoload.php';
require_once 'Helpers/helper.php';
require_once 'Config/db.php';
require_once 'Config/parameters.php';
if(isset($_GET['controller'])){
$nameController = $_GET['controller'] . 'Controller';
}elseif(!isset($_GET['controller']) && !isset($_GET['action'])){
$nameController = controllerDefault;
}else{
Utils::showError();
}
if(class_exists($nameController)){
$controller = new $nameController();
if(isset($_GET['action']) && method_exists($controller, $_GET['action'])){
$action = $_GET['action'];
$controller->$action();
}elseif(!isset($_GET['controller']) && !isset($_GET['action'])){
$actionDefault = actionDefault;
$controller->$actionDefault();
}else{
Utils::showError();
}
}else{
Utils::showError();
}
?>