Commit a0f8f60ed29f08d63d4bc8c022a5c186366f3935
1 parent
83dd807a
fix(): ajustements sur les redirections lors de mauvais accès+correction de la r…
…éservation de créneaux déjà passés
Showing
5 changed files
with
39 additions
and
6 deletions
Show diff stats
html/ajoutAppareil.php
@@ -18,6 +18,8 @@ | @@ -18,6 +18,8 @@ | ||
18 | if(isset($_SESSION['identifiant'])){ | 18 | if(isset($_SESSION['identifiant'])){ |
19 | $login = $_SESSION['identifiant']; | 19 | $login = $_SESSION['identifiant']; |
20 | echo "Vous etes : $login <br>"; | 20 | echo "Vous etes : $login <br>"; |
21 | + }else{ | ||
22 | + echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">"; | ||
21 | } | 23 | } |
22 | include("connexion.php"); | 24 | include("connexion.php"); |
23 | if(isset($_POST['banc']) && isset($_POST['ip']) && isset($_POST['name']) && isset($_POST['type'])){ | 25 | if(isset($_POST['banc']) && isset($_POST['ip']) && isset($_POST['name']) && isset($_POST['type'])){ |
html/gestionAppareil.php
@@ -18,10 +18,10 @@ | @@ -18,10 +18,10 @@ | ||
18 | </form> | 18 | </form> |
19 | <?php | 19 | <?php |
20 | session_start(); | 20 | session_start(); |
21 | - if(isset($_SESSION['identifiant'])=="admin"){ | 21 | + if(isset($_SESSION['identifiant']) && $_SESSION['identifiant']=="admin"){ |
22 | $identifiant = $_SESSION['identifiant']; | 22 | $identifiant = $_SESSION['identifiant']; |
23 | }else{ | 23 | }else{ |
24 | - echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">"; | 24 | + echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">"; |
25 | } | 25 | } |
26 | include("connexion.php"); | 26 | include("connexion.php"); |
27 | $requete = "SELECT * FROM equipement"; | 27 | $requete = "SELECT * FROM equipement"; |
html/gestionBanc.php
@@ -18,10 +18,10 @@ | @@ -18,10 +18,10 @@ | ||
18 | </form> | 18 | </form> |
19 | <?php | 19 | <?php |
20 | session_start(); | 20 | session_start(); |
21 | - if(isset($_SESSION['identifiant'])=="admin"){ | 21 | + if(isset($_SESSION['identifiant']) && $_SESSION['identifiant']=="admin"){ |
22 | $identifiant = $_SESSION['identifiant']; | 22 | $identifiant = $_SESSION['identifiant']; |
23 | }else{ | 23 | }else{ |
24 | - echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">"; | 24 | + echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">"; |
25 | } | 25 | } |
26 | include("connexion.php"); | 26 | include("connexion.php"); |
27 | $requete = "SELECT * FROM banc"; | 27 | $requete = "SELECT * FROM banc"; |
html/gestionReservation.php
@@ -18,10 +18,10 @@ | @@ -18,10 +18,10 @@ | ||
18 | </form> | 18 | </form> |
19 | <?php | 19 | <?php |
20 | session_start(); | 20 | session_start(); |
21 | - if(isset($_SESSION['identifiant'])){ | 21 | + if(isset($_SESSION['identifiant']) && $_SESSION['identifiant']=="admin"){ |
22 | $identifiant = $_SESSION['identifiant']; | 22 | $identifiant = $_SESSION['identifiant']; |
23 | }else{ | 23 | }else{ |
24 | - echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">"; | 24 | + echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">"; |
25 | } | 25 | } |
26 | include("connexion.php"); | 26 | include("connexion.php"); |
27 | $requete = "SELECT * FROM banc ORDER BY numero"; | 27 | $requete = "SELECT * FROM banc ORDER BY numero"; |
html/reservation.php
@@ -133,6 +133,36 @@ | @@ -133,6 +133,36 @@ | ||
133 | var xhttp = new XMLHttpRequest(); | 133 | var xhttp = new XMLHttpRequest(); |
134 | var params = "date="+realDate+"&banc="+realBanc; | 134 | var params = "date="+realDate+"&banc="+realBanc; |
135 | console.log(params); | 135 | console.log(params); |
136 | + /* Enleve les creneaux deja passes dans la journee pour ne plus pouvoir les reserver */ | ||
137 | + var horaire = new Date(); | ||
138 | + var mois = parseInt(horaire.getMonth())+1; | ||
139 | + if(mois<10){ | ||
140 | + var nouvMois = "0"+mois; | ||
141 | + }else{ | ||
142 | + var nouvMois = mois; | ||
143 | + } | ||
144 | + var jour = horaire.getDate(); | ||
145 | + if(jour<10){ | ||
146 | + var nouvJour = "0"+jour; | ||
147 | + }else{ | ||
148 | + var nouvJour = jour; | ||
149 | + } | ||
150 | + var laDate = nouvJour+"/"+nouvMois+"/"+horaire.getFullYear(); | ||
151 | + console.log(laDate); | ||
152 | + console.log(realDate); | ||
153 | + if(laDate==realDate){ | ||
154 | + var heure = horaire.getHours(); | ||
155 | + for(var i=0;i<parseInt(heure);i++){ | ||
156 | + var chgt = document.getElementById(i); | ||
157 | + chgt.disabled=true; | ||
158 | + console.log(chgt.value); | ||
159 | + chgt.color="red"; | ||
160 | + } | ||
161 | + var chgt = document.getElementById(heure); | ||
162 | + chgt.selected=true; | ||
163 | + calcul_fin(); | ||
164 | + } | ||
165 | + /* */ | ||
136 | xhttp.onreadystatechange=function(){ | 166 | xhttp.onreadystatechange=function(){ |
137 | if(xhttp.readyState==4){ | 167 | if(xhttp.readyState==4){ |
138 | // Si requete faite, on modifie les horaires non dispo | 168 | // Si requete faite, on modifie les horaires non dispo |
@@ -158,6 +188,7 @@ | @@ -158,6 +188,7 @@ | ||
158 | } | 188 | } |
159 | } | 189 | } |
160 | } | 190 | } |
191 | + | ||
161 | xhttp.open('POST','dispoCreneau.php',true); | 192 | xhttp.open('POST','dispoCreneau.php',true); |
162 | xhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); | 193 | xhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); |
163 | xhttp.send(params); | 194 | xhttp.send(params); |