Blame view

html/mesReservations.php 2.85 KB
9de9bb41   lwadbled   feat(html): Ajout...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  <!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"> 
1e9bd9e8   jdelabre   feat(*): verifica...
17
  			<button class="btn-lg btn-secondary" type="submit">Retour au menu</button>
9de9bb41   lwadbled   feat(html): Ajout...
18
19
20
21
22
  		</form>
  		<?php
  			session_start();
  			if(isset($_SESSION['identifiant'])){
  				$identifiant = $_SESSION['identifiant'];
1e9bd9e8   jdelabre   feat(*): verifica...
23
24
  			}else{
  				echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
9de9bb41   lwadbled   feat(html): Ajout...
25
26
27
28
29
30
31
32
  			}
  			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){
1e9bd9e8   jdelabre   feat(*): verifica...
33
  				echo "Aucun banc d'essai n'a été réservé";
9de9bb41   lwadbled   feat(html): Ajout...
34
  			}else{
1e9bd9e8   jdelabre   feat(*): verifica...
35
36
37
  				echo "<div class='px-4 py-4 my-5 text-center'>";
  				echo "Vos reservations ($identifiant) : <br>";
  				echo "</div>";
9de9bb41   lwadbled   feat(html): Ajout...
38
39
40
41
42
  				$requete = "SELECT * FROM reservation WHERE
  					personne = '".$identifiant."'";
  				$exec_requete = mysqli_query($db,$requete);
  				$reponse = mysqli_fetch_all($exec_requete);
  				foreach($reponse as $creneau){
1e9bd9e8   jdelabre   feat(*): verifica...
43
  					echo "<div class='px-4 py-4 my-5 text-center border-top'>";
9de9bb41   lwadbled   feat(html): Ajout...
44
45
  					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]'>";
1e9bd9e8   jdelabre   feat(*): verifica...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  					echo "<button class='btn-lg btn-danger' type='submit'>Supprimer la reservation</button>";
  					echo "</form>";
  					/* Utilisation pour accès aux reservations */
  					echo "<form method='POST' action='main.php'>";
  					date_default_timezone_set('Europe/Paris');
  					$ActualDate = date("d/m/Y",time());
  					if($ActualDate==$creneau[1]){
  						$ActualHour = date("h:i",time());
  						$Periode = date("a",time());
  						if($Periode=="pm"){
  							$newHour = explode(":",$ActualHour);
  							$Heure = $newHour[0]+12;
  							$ActualHour = "".$Heure.":".$newHour[1];
  						}
  						if(!($creneau[3]<=$ActualHour && $ActualHour<$creneau[4])){
  							echo "<button class='btn-lg btn-outline-success' type='submit' disabled ";
  						}else{
  							echo "<button class='btn-lg btn-success' type='submit'";
  						}
  					}else{
  						echo "<button class='btn-lg btn-outline-success' type='submit' disabled ";
  					}
  					echo ">Acceder au banc</button>";
9de9bb41   lwadbled   feat(html): Ajout...
69
70
71
72
73
  					echo "</form>";
  					echo "</div>";
  				}
  			}
  			mysqli_close($db);
9de9bb41   lwadbled   feat(html): Ajout...
74
75
76
  		?>
  	</body>
  </html>