index.php
1.22 KB
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
<?php
define('BASEURL', dirname($_SERVER['SCRIPT_NAME']));
ob_start();
// Afficher les erreurs à l'écran
ini_set('display_errors', 1);
// Enregistrer les erreurs dans un fichier de log
ini_set('log_errors', 1);
// Nom du fichier qui enregistre les logs (attention aux droits à l'écriture)
ini_set('error_log', dirname(__file__) . '/log_error_php.txt');
// Afficher les erreurs et les avertissements
//error_reporting(e_all);
include 'struct.php';
//$db= structFunctions::load_histogram_db();
if(isset($_SERVER['PATH_INFO'])) {
$args = explode('/', $_SERVER['PATH_INFO']);
$found = false;
if(count($args) >= 3) {
$controller = $args[1];
$method = $args[2];
$params = array();
for ($i=3; $i < count($args); $i++) {
$params[] = $args[$i];
}
$controller_file = dirname(__FILE__).'/controller/rssi_'.$controller.'.php';
if (is_file($controller_file)) {
require_once $controller_file;
$controller_name = 'Controller_'.ucfirst($controller);
if (class_exists($controller_name)) {
$c = new $controller_name;
if (method_exists($c, $method)) {
$found = true;
call_user_func_array(array($c, $method), $params);
}
}
}
}
if (!$found) {
//echo print_r($db);
echo 'not found';
}
}
?>