<?php
include("../dyn/session.inc");
// * custom *
if(file_exists("../dyn/custom/var.inc")) {
   include("../dyn/custom/var.inc");
}
else {
  include("../dyn/var.inc");
}
if(isset($_GET['idx']))
    $idx=$_GET['idx'];
else
    $idx="";
if(isset($_GET['obj']))
    $obj=$_GET['obj'];
else
    $obj="";
// classe(s) utilisée(s)
require_once "DB.php";
include ("../dyn/connexion.php");
$DEBUG=0;
$db=& DB :: connect($dsn, $db_option);
if (DB :: isError($db)) {
    die($db->getMessage());
}else{
    if($DEBUG==1)
    echo "La base ".$dsn['database']." est connectée.<br>";
    // variables collectivites
    $res = $db->query($sql_collectivite);
    if (DB :: isError($res))
       die($res->getMessage()."erreur ".$sql_collectivite);
    else{
        $k=0;
        while ($row=& $res->fetchRow()){
              $ville=$row[0];
              $logo=$row[1];
    }}
    $res->free();
    $adresseip=$db->getOne("select adresseip from tcpip where idip=$idx");
    if (strstr($obj,"station")) $port=":5800";
    else $port="";
//*
    echo"<head>";
    if ($adresseip) echo "<meta http-equiv='refresh' content='0 ; url=http://$adresseip$port'>";
    include("../dyn/entete.inc");
    echo "</head>";

    echo "<body>";
    if ($adresseip)
       echo "<p><a href='http://$adresseip$port'>Redirection</a></p>";
//       echo "Patientez pendant la redirection";
    else
       echo "Adresse IP invalide!";
    $db->disconnect();
    if ($DEBUG == 1)
        echo "La base ".$dsn['database']." est déconnectée.<br>";
}
echo "</body></html>";
?>