root/trunk/dotnode-response.php

Revision 10, 2.6 KB (checked in by alexx, 7 years ago)

* remove last "domain dependency" (hard coded domain)
* replace hard coded IP or login (for debug/administration purpose) by configuration array $configadmin_login? and $configadmin_ip?
* replace hard coded email by $configemail?
* manage smarty var by $_SMARTY (that will be assigned on time at the end of script), dotnode-*.php from the root has been modified
* fixe gettext file to reflect change into terms that contain an hard coded email
* some minor change

Line 
1<?php
2/****************************************************** Open .node ***
3 * Description:   
4 * Status:        Stable.
5 * Author:        Alexandre Dath <alexandre@dotnode.com>
6 * $Id$
7 *
8 * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************** http://opensource.ikse.net/projects/dotnode ***/
24
25include('../includes/includes.inc.php');
26include('../includes/config/global.inc.php');
27
28session_start();
29
30$token = retreive_url_info($_SERVER['PHP_SELF']);
31
32if(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}
66elseif($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}
83else
84    header('Location: /');
Note: See TracBrowser for help on using the browser.