mesReservations.php 2.14 KB
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title>Page principale</title>
		<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
		      rel="stylesheet"
		      integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
		      crossorigin="anonymous">
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
			integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//E1J19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
			crossorigin="anonymous">
		</script>
	</head>
	<body>
		<form method="POST" action="menu.php"> 
			<button class="btn-lg btn-success" type="submit">Retour au menu</button>
		</form>
		<?php
			session_start();
			if(isset($_SESSION['identifiant'])){
				$identifiant = $_SESSION['identifiant'];
				echo "Bonjour $identifiant, vous êtes connecté<br>";
			}
			include("connexion.php");
			$requete = "SELECT count(*) FROM reservation WHERE
				personne = '".$identifiant."'";
			$exec_requete = mysqli_query($db,$requete);
			$reponse = mysqli_fetch_array($exec_requete);
			$count = $reponse['count(*)'];
			if($count == 0){
				echo "Aucun banc d'essai n'a ete reservé";
			}else{
				echo "Vos reservations : <br>";
				$requete = "SELECT * FROM reservation WHERE
					personne = '".$identifiant."'";
				$exec_requete = mysqli_query($db,$requete);
				$reponse = mysqli_fetch_all($exec_requete);
				foreach($reponse as $creneau){
					echo "<div>";
					echo "Banc : $creneau[0] | Date : $creneau[1] $creneau[3]-$creneau[4]";
					echo "<form method='POST' action='supprReservation.php?banc=$creneau[0]&moment=$creneau[1]&personne=$identifiant&heuredebut=$creneau[3]&heurefin=$creneau[4]'>";
					echo "<button class='btn-lg btn-success' type='submit'>Supprimer la reservation</button>";
					echo "</form>";
					echo "</div>";
				}
			}
			mysqli_close($db);
			/* Utilisation pour accès aux reservations
			date_default_timezone_set('Europe/Paris');
			$ActualDate = date("d/m/Y",time());
			$ActualHour = date("h:i",time());
			$Periode = date("a",time());
			echo "Vrai date : ".$ActualDate." / Vrai heure = ".$ActualHour.$Periode."<br>"; */
		?>
	</body>
</html>