Blame view

html/gestionAppareil.php 2.59 KB
46de4374   lwadbled   feat(gestionAppar...
1
2
3
4
  <!DOCTYPE html>
  <html>
  	<head>
  		<meta charset="utf-8"/>
c1606691   lwadbled   feat(gestionBanc....
5
  		<title>Gestion des appareils</title>
46de4374   lwadbled   feat(gestionAppar...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  		<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-secondary" type="submit">Retour au menu</button>
  		</form>
  		<?php
  			session_start();
a0f8f60e   lwadbled   fix(): ajustement...
21
  			if(isset($_SESSION['identifiant']) && $_SESSION['identifiant']=="admin"){
46de4374   lwadbled   feat(gestionAppar...
22
23
  				$identifiant = $_SESSION['identifiant'];
  			}else{
a0f8f60e   lwadbled   fix(): ajustement...
24
  				echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">";
46de4374   lwadbled   feat(gestionAppar...
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  			}
  			include("connexion.php");
  			$requete = "SELECT * FROM equipement";
  			$exec_requete = mysqli_query($db,$requete);
  			$reponse = mysqli_fetch_all($exec_requete);
  			$requete = "SELECT * FROM banc";
  			$exec_requete = mysqli_query($db,$requete);
  			$banc = mysqli_fetch_all($exec_requete);
  			mysqli_close($db);
  			/* Affichage des appareils */
  			echo "<table class='table table-striped'>";
  			echo "<thead>";
  			echo "<tr>";
  			echo "<th>Banc</th>";
  			echo "<th>IP</th>";
  			echo "<th>Nom de l'appareil</th>";
  			echo "<th>Type d'appareil</th>";
  			echo "<th></th>";
  			echo "</tr>";
  			echo "</thead>";
  			echo "<tbody>";
  			for($i=0;$i<count($reponse);$i++){
  				echo "<tr>";
  				echo "<td>".$reponse[$i][0]."</td>";
  				echo "<td>".$reponse[$i][1]."</td>";
  				echo "<td>".$reponse[$i][2]."</td>";
  				echo "<td>".$reponse[$i][3]."</td>";
  				echo "<td><form method='POST' action='supprAppareil.php?ip=".$reponse[$i][1]."'><button class='btn-lg btn-danger' type='submit'>Supprimer l'appareil</button></form>";
  				echo "</tr>";
  			}
  			/* Ajout appareil */
  			echo "<form method='POST' action='ajoutAppareil.php'>";
  			echo "<tr>";
  			echo "<td><select class='select' name='banc' id='banc' required>";
  			foreach($banc as $value){
  				echo '<option value="'.$value[0].'">'.$value[0].'</option>';
  			}	
  			echo "</select></td>";
  			echo "<td><input type='text' name='ip' required></td>";
  			echo "<td><input type='text' name='name' required></td>";
  			echo "<td><input type='text' name='type' required></td>";
  			echo "<td><button class='btn-lg btn-success' type='submit'>Ajouter l'appareil</button></td>";
  			echo "</tr>";
  			echo "</tbody>";
  			echo "</table>";	
  			echo "</form>";
  		?>
  	</body>
  </html>