<?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>
      function return_ok_client(no) {
        if (event.keyCode == 10 || event.keyCode == 13 || event.keyCode == 32) {
          ok_client(no);
        }
      }
    </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(3, NOUVEAU, 1, '', $NoVisu, $Nom, $Prenom, $Mode);
        break;
      case 1:
        Valide_Modif(3, NOUVEAU, 1, '', $NoVisu, ", DateModif, PersonneModif", ", '" . date("Y-m-d") . "', '" . addslashes($lg_user) . "'");
        $id_client = Connection::getConnection()->lastInsertId();
        //$id_client = 1556;
        echo "<SCRIPT language=JavaScript>\n";
        echo "window.opener.recherche_client_dialog_affecte($id_client, '" . $_GET['Mode'] . "', '" . $_GET['Form'] . "');\n";
        echo "window.close();\n";
        echo "</SCRIPT>\n";
        break;
    }
    ?>
  </body>

  </html>
<?php
}
?>