/
config.php
executable file
·56 lines (44 loc) · 969 Bytes
/
config.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
49
50
51
52
53
54
55
56
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$url = explode("/",$_GET["path"]);
$raiz = "";
for ($i=0; $i < count($url) - 1; $i++) {
$raiz .= "../";
}
foreach (glob("classe/*.php") as $filename) {
require_once $filename;
}
$_REQUEST['raiz'] = $raiz;
define("DIRETORIO", $raiz);
$controle = $url[0];
$acao = $url[1];
foreach ($url as $key => $value) {
if($key > 1 && $key%2 == 0){
$_REQUEST[$value] = $url[($key + 1)];
}
}
$sessao = new Sessao;
if($controle == "" && $acao == ""){
if($sessao -> verifica()){
header("Location: usuario/home");
} else {
header("Location: usuario/login");
}
}
function debug($x){
echo "<pre>";
print_r($x);
echo "</pre>";
}
require_once 'visao/topo.php';
echo "<title>$controle - $acao</title>";
$controle .= "Controle";
require_once 'controle/'.$controle.'.php';
$obj = new $controle();
if($acao != ""){
$obj->$acao();
} else {
$obj->index();
}
require_once 'visao/rodape.php';
?>