Commit e8885fa6c08277827fc8a60fe4579b65fdd8d80e
1 parent
522e6f8f
Test
Showing
7 changed files
with
96 additions
and
4 deletions
Show diff stats
site/accesBase.php
... | ... | @@ -60,6 +60,19 @@ |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | + function suppression($id) | |
64 | + { | |
65 | + $db = connexion(); | |
66 | + $query = "DELETE FROM membres WHERE identifiant = '$id'"; | |
67 | + $result = pg_query($db, $query) or die("La requête a echoué : ".pg_last_error()); | |
68 | + if (pg_affected_rows($result)!=0){ | |
69 | + return True; | |
70 | + } | |
71 | + else{ | |
72 | + return False; | |
73 | + } | |
74 | + } | |
75 | + | |
63 | 76 | function getGroupe($id) |
64 | 77 | { |
65 | 78 | $db = connexion(); | ... | ... |
site/formInscription.php
... | ... | @@ -52,7 +52,7 @@ $groupes = getGroupes(); |
52 | 52 | </tr> |
53 | 53 | </tbody> |
54 | 54 | </table> |
55 | - <input type="submit" class="btn btn-dark btn-lg btn-block" style="margin-top:20px; margin-bottom:20px;" value="S'inscrire"/> | |
55 | + <input type="submit" class="btn btn-dark btn-lg btn-block" style="margin-top:20px; margin-bottom:20px;" value="Ajouter"/> | |
56 | 56 | <br/> |
57 | 57 | </form> |
58 | 58 | </div> | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +<?php | |
2 | +if(getGroupe($_SESSION['Login'])!=1) | |
3 | +{ header("Location: accueil.php"); } | |
4 | +$groupes = getGroupes(); | |
5 | +?> | |
6 | +<div class="row"> | |
7 | + <div class="col-4 col-md-4 offset-md-4 offset-4"> | |
8 | + <br/> | |
9 | + <h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-user-slash"></i> Supprimer un compte</h1> | |
10 | + <form action="suppression.php" method="post"> | |
11 | + <table class="table table-striped table-bordered"> | |
12 | + <tbody> | |
13 | + <tr> | |
14 | + <td>Identifiant : </td> | |
15 | + <td><input type="text" name="id" placeholder="Entrez votre identifiant" maxlength="30" required="true" /></td> | |
16 | + </tr> | |
17 | + </tbody> | |
18 | + </table> | |
19 | + <input type="submit" class="btn btn-dark btn-lg btn-block" style="margin-top:20px; margin-bottom:20px;" value="Supprimer"/> | |
20 | + <br/> | |
21 | + </form> | |
22 | + </div> | |
23 | +</div> | ... | ... |
site/header.php
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | <?php |
20 | 20 | if(getGroupe($_SESSION['Login'])==1) |
21 | 21 | { |
22 | - echo '<a href="inscrire.php"><i class="far fa-plus-square"></i> Compte</a>'; | |
22 | + echo '<a href="inscrire.php"><i class="fas fa-users-cog"></i> Compte</a>'; | |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | <a href="deconnecter.php"><i class="fa fa-power-off"></i> Deconnexion</a> | ... | ... |
site/inscription.php
... | ... | @@ -26,7 +26,7 @@ if(getGroupe($_SESSION['Login'])!=1) |
26 | 26 | { |
27 | 27 | if(inscription($_POST["id"], $_POST["pass1"], $_POST["nom"], $_POST["prenom"], $_POST["groupe"])) |
28 | 28 | { |
29 | - $retour = "Nouveau compte créé avec succès "; | |
29 | + $retour = "Nouveau compte créé avec succès !"; | |
30 | 30 | $color = "alert-success"; |
31 | 31 | } |
32 | 32 | else | ... | ... |
site/inscrire.php
... | ... | @@ -15,7 +15,10 @@ session_start(); |
15 | 15 | include("header.php"); |
16 | 16 | require_once("accesBase.php"); |
17 | 17 | if(getGroupe($_SESSION['Login'])==1) |
18 | - { include("formInscription.php"); } | |
18 | + { | |
19 | + include("formSuppression.php"); | |
20 | + include("formInscription.php"); | |
21 | + } | |
19 | 22 | else |
20 | 23 | { header("Location: accueil.php"); } |
21 | 24 | ?> | ... | ... |
... | ... | @@ -0,0 +1,53 @@ |
1 | +<?php | |
2 | +session_start(); | |
3 | +require_once("accesBase.php"); | |
4 | +if(getGroupe($_SESSION['Login'])!=1) | |
5 | +{ header("Location: accueil.php"); } | |
6 | +?> | |
7 | + | |
8 | +<!DOCTYPE html> | |
9 | + | |
10 | +<html> | |
11 | + <head> | |
12 | + <?php include("head.php"); ?> | |
13 | + </head> | |
14 | + | |
15 | + <!-- Contenu du site --> | |
16 | + <body> | |
17 | + <?php include("header.php"); ?> | |
18 | + | |
19 | + <!-- Centre de la page --> | |
20 | + <div class="row"> | |
21 | + <div class="col-6 col-md-6 offset-3 offset-md-3" style="margin-top:70px;"> | |
22 | + <?php | |
23 | + if (!notAMember($_POST["id"])) | |
24 | + { | |
25 | + if(suppression($_POST["id"])) | |
26 | + { | |
27 | + $retour = "Suppression réussie !"; | |
28 | + $color = "alert-success"; | |
29 | + } | |
30 | + else | |
31 | + { | |
32 | + $retour = "Echec lors de la suppression !"; | |
33 | + $color = "alert-danger"; | |
34 | + } | |
35 | + } | |
36 | + else | |
37 | + { | |
38 | + $retour = "Le compte n'existe pas !"; | |
39 | + $color = "alert-danger"; | |
40 | + } | |
41 | + ?> | |
42 | + <br/> | |
43 | + <div class="alert <?php echo $color;?>" role="alert"> | |
44 | + <?php echo $retour;?> | |
45 | + <meta http-equiv="Refresh" content="5;url=accueil.php" /> | |
46 | + </div> | |
47 | + </div> | |
48 | + </div> | |
49 | + <!-- fin contenu de la page --> | |
50 | + </div> | |
51 | + <!-- fin centre de la page --> | |
52 | + </body> | |
53 | +</html> | ... | ... |