Commit d3479236d9127efc377dd032ace7e7cb4599b6fb
1 parent
9507838e
MAJ
Showing
3 changed files
with
59 additions
and
2 deletions
Show diff stats
site/accesBase.php
@@ -44,6 +44,15 @@ | @@ -44,6 +44,15 @@ | ||
44 | $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); | 44 | $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); |
45 | return pg_affected_rows($result); | 45 | return pg_affected_rows($result); |
46 | } | 46 | } |
47 | + | ||
48 | + function members() | ||
49 | + { | ||
50 | + $db = connexion(); | ||
51 | + $query = "SELECT * FROM membres"; | ||
52 | + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); | ||
53 | + $tab = pg_fetch_all($result); | ||
54 | + return $tab; | ||
55 | + } | ||
47 | 56 | ||
48 | function inscription($id, $pwd, $nom, $prenom, $groupe) | 57 | function inscription($id, $pwd, $nom, $prenom, $groupe) |
49 | { | 58 | { |
@@ -83,6 +92,16 @@ | @@ -83,6 +92,16 @@ | ||
83 | return $tab['groupe']; | 92 | return $tab['groupe']; |
84 | } | 93 | } |
85 | 94 | ||
95 | + function groupeId($id) | ||
96 | + { | ||
97 | + $db = connexion(); | ||
98 | + $query = "SELECT groupe FROM groupes where id = '$id'"; | ||
99 | + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); | ||
100 | + $tab = pg_fetch_assoc($result); | ||
101 | + deconnexion($db); | ||
102 | + return $tab['groupe']; | ||
103 | + } | ||
104 | + | ||
86 | function getGroupes() | 105 | function getGroupes() |
87 | { | 106 | { |
88 | $db = connexion(); | 107 | $db = connexion(); |
site/formSuppression.php
1 | <?php | 1 | <?php |
2 | if(getGroupe($_SESSION['Login'])!=1) | 2 | if(getGroupe($_SESSION['Login'])!=1) |
3 | { header("Location: accueil.php"); } | 3 | { header("Location: accueil.php"); } |
4 | -$groupes = getGroupes(); | ||
5 | ?> | 4 | ?> |
6 | <div class="row"> | 5 | <div class="row"> |
7 | <div class="col-6 col-md-6 offset-md-3 offset-3"> | 6 | <div class="col-6 col-md-6 offset-md-3 offset-3"> |
site/inscrire.php
1 | <?php | 1 | <?php |
2 | session_start(); | 2 | session_start(); |
3 | +require_once("accesBase.php"); | ||
4 | +$membres = members(); | ||
3 | ?> | 5 | ?> |
4 | 6 | ||
5 | <!DOCTYPE html> | 7 | <!DOCTYPE html> |
@@ -13,9 +15,46 @@ session_start(); | @@ -13,9 +15,46 @@ session_start(); | ||
13 | <body> | 15 | <body> |
14 | <?php | 16 | <?php |
15 | include("header.php"); | 17 | include("header.php"); |
16 | - require_once("accesBase.php"); | ||
17 | if(getGroupe($_SESSION['Login'])==1) | 18 | if(getGroupe($_SESSION['Login'])==1) |
18 | { | 19 | { |
20 | + ?> | ||
21 | + <div class="row"> | ||
22 | + <div class="col-6 col-md-6 offset-md-3 offset-3"> | ||
23 | + <br/> | ||
24 | + <h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-database"></i> Membres</h1> | ||
25 | + <table class="table table-striped table-bordered"> | ||
26 | + <tbody> | ||
27 | + <tr> | ||
28 | + <td>Nom</td> | ||
29 | + <td>Prénom</td> | ||
30 | + <td>Identifiant</td> | ||
31 | + <td>Groupe</td> | ||
32 | + <td>Action</td> | ||
33 | + </tr> | ||
34 | + | ||
35 | + <?php | ||
36 | + foreach($membres as $membre){ | ||
37 | + ?> | ||
38 | + <tr> | ||
39 | + <td><?php echo $membre['nom'];?></td> | ||
40 | + <td><?php echo $membre['prenom'];?></td> | ||
41 | + <td><?php echo $membre['identifiant'];?></td> | ||
42 | + <td><?php echo groupeId($membre['groupe']);?></td> | ||
43 | + <td> | ||
44 | + <form action="suppression.php" method="POST"> | ||
45 | + <input type="hidden" name="id" value="<?php echo $membre['identifiant'];?>"> | ||
46 | + <input type="submit" name="supprimer" value="Supprimer"> | ||
47 | + </form> | ||
48 | + </td> | ||
49 | + </tr> | ||
50 | + <?php | ||
51 | + } | ||
52 | + ?> | ||
53 | + </tbody> | ||
54 | + </table> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <?php | ||
19 | include("formSuppression.php"); | 58 | include("formSuppression.php"); |
20 | include("formInscription.php"); | 59 | include("formInscription.php"); |
21 | } | 60 | } |