| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | include('../includes/includes.inc.php'); |
|---|
| 26 | include('../includes/config/global.inc.php'); |
|---|
| 27 | |
|---|
| 28 | session_start(); |
|---|
| 29 | |
|---|
| 30 | $token = retreive_url_info($_SERVER['PHP_SELF']); |
|---|
| 31 | |
|---|
| 32 | if(strlen($token[1]) == 32) |
|---|
| 33 | { |
|---|
| 34 | list($url_id) = array_splice($token, 1,1); |
|---|
| 35 | |
|---|
| 36 | error_log($_SERVER['HTTP_HOST'].' | '.$_SERVER['PHP_SELF'].' | '.$_SESSION['my_login']); |
|---|
| 37 | |
|---|
| 38 | $db =& DB::connect($dsn); |
|---|
| 39 | if (DB::isError($db)) |
|---|
| 40 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage()); |
|---|
| 41 | $db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 42 | |
|---|
| 43 | for($idx=(count($token)-1); $idx>=0; $idx--) |
|---|
| 44 | { |
|---|
| 45 | $response = ''; |
|---|
| 46 | for($level=1; $level<=$idx; $level++) |
|---|
| 47 | $response .= $token[$level].'/'; |
|---|
| 48 | $response = substr($response,0,-1).'.response.php'; |
|---|
| 49 | error_log($_SERVER['HTTP_HOST'].' | Include response : '.RESPONSESPATH.'/'.$response); |
|---|
| 50 | if(file_exists(RESPONSESPATH.'/'.$response)) |
|---|
| 51 | break; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | if(file_exists(RESPONSESPATH.'/'.$response) ) |
|---|
| 55 | include(RESPONSESPATH.'/'.$response); |
|---|
| 56 | else |
|---|
| 57 | { |
|---|
| 58 | header("HTTP/1.1 403 Forbidden"); |
|---|
| 59 | print $_SERVER["PHP_SELF"].": Response forbidden<br />\n"; |
|---|
| 60 | if($_SERVER['REMOTE_ADDR'] == $config['admin_ip']) |
|---|
| 61 | print RESPONSESPATH.'/'.$response; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | $db->disconnect(); |
|---|
| 65 | } |
|---|
| 66 | elseif($token[1] == '6nergies') |
|---|
| 67 | { |
|---|
| 68 | |
|---|
| 69 | if(file_exists(RESPONSESPATH.'/6nergies.response.php')) |
|---|
| 70 | { |
|---|
| 71 | $db =& DB::connect($dsn); |
|---|
| 72 | if (DB::isError($db)) |
|---|
| 73 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage()); |
|---|
| 74 | $db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 75 | |
|---|
| 76 | include(RESPONSESPATH.'/6nergies.response.php'); |
|---|
| 77 | $db->disconnect(); |
|---|
| 78 | |
|---|
| 79 | } |
|---|
| 80 | else |
|---|
| 81 | error_log('ERROR: pas de 6nergies.response.php'); |
|---|
| 82 | } |
|---|
| 83 | else |
|---|
| 84 | header('Location: /'); |
|---|