<?php
require 'database.inc.php';
if (Test_User($lg_user, $lg_password) == TRUE) {
?>
  <html>

  <head>
    <meta http-equiv='content-type' content='text/html;charset=utf-8'>
    <SCRIPT language=JavaScript src='valideformulaire.js' type=text/javascript></SCRIPT>
    <SCRIPT language=JavaScript src='atelier.js' type=text/javascript></SCRIPT>
    <title>WebBike V<?php echo VERSION; ?></title>
    <?php
    $size = 2;
    if ($ligne = Poste::getPostesByIP()) {
      $size = $ligne['Size'];
    }
    echo "<link href='css/style$size.css' rel='stylesheet' media='screen'>\n";

    echo "<link href='" . CSS_FOLDER . "style.css' rel='stylesheet' media='screen'>\n"
    ?>
  </head>

  <body>
    <?php
    $ligne = Vehicule::getVehiculeByNoChassis(addslashes($NoChasis));
    $ligne2 = VehiculesLocation::getVehiculeLocationByNoChassis(addslashes($NoChasis));
    echo "<big>$NoChasis " . $ligne['Model'] . " " . $ligne['Couleur'] . " " . $ligne2['NoPlaque'] . "</big><BR>\n";
    $resultat = Location::getByNoChassis(addslashes($NoChasis));
    echo "<TABLE class=\"vhc_loc\" border=1><TR><TH>Nom</TH><TH>Début</TH><TH>Fin</TH><TH>Etat retour</TH></TR>\n";
    foreach ($resultat as $ligne) {
      if ($ligne['DebutEffectif'] != "") {
        $debut = Cree_Entree_Type("", 18, 0, $ligne['DebutEffectif'], AFFICHAGE);
      } else {
        $debut = Cree_Entree_Type("", 18, 0, $ligne['Debut'], AFFICHAGE);
      }
      if ($ligne['FinEffectif'] != "") {
        $fin = Cree_Entree_Type("", 18, 0, $ligne['FinEffectif'], AFFICHAGE);
      } else {
        $fin = Cree_Entree_Type("", 18, 0, $ligne['Fin'], AFFICHAGE);
      }
      echo "<TR><TD><A HREF='location.php?new=0&Start=" . $ligne['Debut'] . "&vhc=" . $ligne['NoChasis'] . "' TARGET='_blank' rel='opener'>" . $ligne['Nom'] . " " . $ligne['Prenom'] . "</A></TD><TD>$debut</TD><TD>$fin</TD><TD>" . $ligne['RemarqueRetour'] . "&nbsp;</TD></TR>\n";
    }
    echo "</TABLE>\n";

    ?>
  </body>

  </html>
<?php
}
?>