<?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>
      this.window.resizeTo(800, 600);
    </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"
    ?>
    <link href="style.css" rel="stylesheet" media="screen">
  </head>

  <body>
    <?php
    $Type = 3;
    $Sous_Type = 3;
    if (!isset($Etape)) {
      $Etape = 0;
    }
    if (!isset($Mode)) {
      $Mode = 0;
    }
    if (!isset($NoVisu)) {
      $NoVisu = 0;
    }
    switch ($Etape) {
      case 0:
        Affiche_formulaire(2, NOUVEAU, 1, '', $NoVisu, $NoClient, '', $Mode);
        break;
      case 1:
        $id_vehicule = Valide_Modif(2, NOUVEAU, 1, '', $NoVisu, ", DateModif, PersonneModif", ", '" . date("Y-m-d") . "', '" . addslashes($lg_user) . "'");
        //$id_vehicule = Connection::getConnection()->lastInsertId();
        echo $id_vehicule;
        if ($ligne = Vehicule::getVehiculeByNoChassis($id_vehicule)) {
          echo "<SCRIPT language=JavaScript>\n";
          $result = Affecte_Resultat_Vehicule($ligne, $Mode);
          echo "window.opener.local_eval(\"$result\");\n";
          echo "window.close();\n";
          echo "</SCRIPT>\n";
        }
        break;
    }
    ?>
  </body>

  </html>
<?php
}
?>