<html>

<head>
  <meta http-equiv='content-type' content='text/html;charset=utf-8'>
  <title>WebBike V1.0</title>
  <link href='style.css' rel='stylesheet' media='screen'>
</head>

<body>
  <?php
  $pas = 1000;
  set_time_limit(300);
  require 'database.inc.php';
  //  session_start();
  //  session_register("lg_user");
  //  session_register("lg_password");
  //  session_register("lg_admin");
  //  session_register("lg_menu1");
  //  session_register("lg_menu2");
  //  session_register("lg_menu3");
  //  session_register("lg_menu4");
  //  session_register("lg_menu5");
  if (Test_User($lg_user, $lg_password) == TRUE) {
    $start = 106090;
    $end = 106449;
    $new = 109000;

    $actual_new_number = $new;
    for ($cpt = $start; $cpt <= $end; $cpt++) {
      $requette = "UPDATE `commande" . ID_GARAGE . "` SET `NoCommande`=$actual_new_number WHERE `NoCommandeAlt`=$cpt";
      $actual_new_number++;
      echo $requette . "<BR>";
      Connection::executeRawQuery($requette);
    }

    $requette = "SELECT * FROM `commande" . ID_GARAGE . "` WHERE `NoCommandeAlt`>=$start AND `NoCommandeAlt`<=$end";
    $resultat = Connection::executeRawQueryWithfetchAll($requette);
    foreach ($resultat as $ligne) {
      $requette2 = "UPDATE `commandearticles" . ID_GARAGE . "` SET `NoCommande`=" . $ligne["NoCommande"] . " WHERE `NoCommande`=" . $ligne["NoCommandeAlt"];
      echo $requette2 . "<BR>";
      Connection::executeRawQuery($requette2);
      $requette3 = "UPDATE `dbcash" . ID_GARAGE . "` SET `NoFacture`=" . $ligne["NoCommande"] . " WHERE `NoFacture`=" . $ligne["NoCommandeAlt"];
      echo $requette3 . "<BR>";
      Connection::executeRawQuery($requette3);
      $requette4 = "UPDATE `location" . ID_GARAGE . "` SET `NoCommande`=" . $ligne["NoCommande"] . " WHERE `NoCommande`=" . $ligne["NoCommandeAlt"];
      echo $requette4 . "<BR>";
      Connection::executeRawQuery($requette4);
      $requette5 = "UPDATE `atelier" . ID_GARAGE . "` SET `NoCommande`=" . $ligne["NoCommande"] . " WHERE `NoCommande`=" . $ligne["NoCommandeAlt"];
      echo $requette5 . "<BR>";
      Connection::executeRawQuery($requette5);
    }
  }
  // }
  ?>
</body>

</html>