"; } include("connexion.php"); $requete = "SELECT * FROM banc ORDER BY numero"; $exec_requete = mysqli_query($db,$requete); $reponse = mysqli_fetch_all($exec_requete); if(isset($_POST['txtDate']) && isset($_POST['banc'])){ $txtDate = $_POST['txtDate']; $banc = $_POST['banc']; }else{ $txtDate = date("Y-n-j"); $banc = $reponse[0][0]; /* Verification de la syntaxe de la date */ $explosion_date = explode("-",$txtDate); $jour = $explosion_date[2]; $mois = $explosion_date[1]; $annee = $explosion_date[0]; if($jour<10){ $jour = "0$jour"; $txtDate = "$annee-$mois-$jour"; } if($mois<10){ $mois = "0$mois"; $txtDate = "$annee-$mois-$jour"; } } ?>
required>
Banc choisi :
"; echo ""; echo ""; echo "Heure de début"; echo "Reservé par"; echo ""; echo ""; echo ""; echo ""; $explosion_date = explode("-",$txtDate); $jour = $explosion_date[2]; $mois = $explosion_date[1]; $annee = $explosion_date[0]; $actualDate = date("Y-m-d"); $new = explode("-",$actualDate); $new_jour = $new[2]; $new_mois = $new[1]; $new_annee = $new[0]; for($i=0;$i<24;$i++){ if($i<10){ $heure = "0".$i.":00"; }else{ $heure = $i.":00"; } echo ""; echo "$heure"; /* Requete pour connaitre l'utilisateur reservant le creneau s'il y en a un */ $requete = "SELECT login FROM reservation WHERE jour='$txtDate' AND numero=$banc AND HEUREDEBUT='$heure'"; $exec_requete = mysqli_query($db,$requete); $reponse = mysqli_fetch_all($exec_requete); if($reponse!=null){ $personne = $reponse[0][0]; echo "$personne"; }else{ echo ""; } if($new_annee>$annee || ($new_annee>=$annee && $new_mois>=$mois && $new_jour>$jour)){ echo "
"; }else if($reponse==null){ echo "
"; }else if($reponse[0][0]=="admin"){ echo "
"; }else{ echo "
"; } echo ""; } echo ""; echo ""; echo ""; mysqli_close($db); ?>