-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
38 lines (29 loc) · 795 Bytes
/
index.php
File metadata and controls
38 lines (29 loc) · 795 Bytes
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
<?php
session_start();
include_once "Libs/Auth.php";
class ClassAutoloader {
public function __construct() {
spl_autoload_register(array($this, 'loader'));
}
private function loader($nomeClasse) {
if(file_exists('Controller/' . $nomeClasse . '.php')){
$pasta = 'Controller/';
} elseif(file_exists('Model/' . $nomeClasse . '.php')) {
$pasta = 'Model/';
}
include_once $pasta . $nomeClasse . '.php';
}
}
new ClassAutoloader();
if (isset($_GET['controller'])) {
$controller = $_GET['controller'];
} else {
$controller = 'SiteController';
}
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = 'index';
}
$controller = new $controller();
$controller->$action();