Commit 83dd807ae7122f87f766e35d04277f7058acab31

Authored by lwadbled
1 parent d35ea2be

fix(Reservation): correction de bugs

html/ajoutReservation.php
@@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
55 $heure = $_GET['heure']; 55 $heure = $_GET['heure'];
56 $requete = "INSERT INTO reservation VALUES($banc,'$date','$login','$heure','$heurefin')"; 56 $requete = "INSERT INTO reservation VALUES($banc,'$date','$login','$heure','$heurefin')";
57 $exec_requete = mysqli_query($db,$requete); 57 $exec_requete = mysqli_query($db,$requete);
  58 + $requete = "INSERT INTO creneau VALUES('$date')";
  59 + $exec_requete = mysqli_query($db,$requete);
58 echo "<meta http-equiv=\"refresh\" content=\"0;url=gestionReservation.php\">"; 60 echo "<meta http-equiv=\"refresh\" content=\"0;url=gestionReservation.php\">";
59 }else{ 61 }else{
60 //echo "L'ajout n'a pas fonctionné"; 62 //echo "L'ajout n'a pas fonctionné";
html/gestionReservation.php
@@ -100,9 +100,13 @@ @@ -100,9 +100,13 @@
100 $requete = "SELECT personne FROM reservation WHERE moment='$new_date' AND reserve=$banc AND HEUREDEBUT='$heure'"; 100 $requete = "SELECT personne FROM reservation WHERE moment='$new_date' AND reserve=$banc AND HEUREDEBUT='$heure'";
101 $exec_requete = mysqli_query($db,$requete); 101 $exec_requete = mysqli_query($db,$requete);
102 $reponse = mysqli_fetch_all($exec_requete); 102 $reponse = mysqli_fetch_all($exec_requete);
103 - $personne = $reponse[0][0];  
104 - echo "<td>$personne</td>";  
105 - if($reponse[0][0]==""){ 103 + if($reponse!=null){
  104 + $personne = $reponse[0][0];
  105 + echo "<td>$personne</td>";
  106 + }else{
  107 + echo "<td></td>";
  108 + }
  109 + if($reponse==null){
106 echo "<td><form method='POST' action='ajoutReservation.php?txtDate=$new_date&banc=$banc&heure=$heure'><button class='btn-lg btn-danger' type='submit'>Bloquer le créneau</button></form>"; 110 echo "<td><form method='POST' action='ajoutReservation.php?txtDate=$new_date&banc=$banc&heure=$heure'><button class='btn-lg btn-danger' type='submit'>Bloquer le créneau</button></form>";
107 }else if($reponse[0][0]=="admin"){ 111 }else if($reponse[0][0]=="admin"){
108 echo "<td><form method='POST' action='supprReservation.php?banc=$banc&moment=$new_date&personne=$personne&heuredebut=$heure'><button class='btn-lg btn-success' type='submit'>Débloquer le créneau</button></form>"; 112 echo "<td><form method='POST' action='supprReservation.php?banc=$banc&moment=$new_date&personne=$personne&heuredebut=$heure'><button class='btn-lg btn-success' type='submit'>Débloquer le créneau</button></form>";
html/supprReservation.php
@@ -14,7 +14,7 @@ if(isset($_GET[&#39;banc&#39;]) &amp;&amp; isset($_GET[&#39;moment&#39;]) &amp;&amp; isset($_GET[&#39;personne&#39;]) &amp;&amp; @@ -14,7 +14,7 @@ if(isset($_GET[&#39;banc&#39;]) &amp;&amp; isset($_GET[&#39;moment&#39;]) &amp;&amp; isset($_GET[&#39;personne&#39;]) &amp;&amp;
14 $requete = "DELETE FROM reservation WHERE 14 $requete = "DELETE FROM reservation WHERE
15 reserve=$banc and moment='$moment' and personne = '$personne' and heuredebut='$heuredebut'"; 15 reserve=$banc and moment='$moment' and personne = '$personne' and heuredebut='$heuredebut'";
16 $exec_requete = mysqli_query($db,$requete); 16 $exec_requete = mysqli_query($db,$requete);
17 - $reponse = mysqli_fetch_array($exec_requete); 17 + //$reponse = mysqli_fetch_array($exec_requete);
18 if($identifiant=="admin"){ 18 if($identifiant=="admin"){
19 echo "<meta http-equiv=\"refresh\" content=\"0;url=gestionReservation.php\">"; 19 echo "<meta http-equiv=\"refresh\" content=\"0;url=gestionReservation.php\">";
20 }else{ 20 }else{