-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·44 lines (37 loc) · 1.02 KB
/
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
<?php
session_start();
require_once 'autoload.php';
require_once 'config/db.php';
require_once 'config/parametres.php';
require_once 'helpers/utils.php';
require_once 'views/layout/header.php';
require_once 'views/layout/sidebar.php';
function show_error() {
$error = new errorController();
$error->index();
}
if(isset($_GET['controller'])) {
$nombre_controlador = $_GET['controller'].'Controller';
} else if (!isset($_GET['controller']) && !isset($_GET['action'])) {
$nombre_controlador = controller_default;
}
else {
show_error();
exit();
}
if(class_exists($nombre_controlador)) {
$controlador = new $nombre_controlador();
if (isset($_GET['action']) && method_exists($controlador, $_GET['action'])) {
$action = $_GET['action'];
$controlador->$action();
} else if (!isset($_GET['controller']) && !isset($_GET['action'])) {
$action_default = action_default;
$controlador->$action_default();
}
else {
show_error();
}
} else {
show_error();
}
require_once 'views/layout/footer.php';