-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
306 lines (261 loc) · 15 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<?php
/**
* @file index.php.
* @author Leon Zhang .
* @version 1.0.
* @date 30 janvier 2019.
* @brief Page d'@b accueil du site.
* @details Cette page comporte un module d'@b authentification
* permettant au membre, moniteur ou à l'administrateur
* de se connecter si celui-ci possède un compte. Le module
* comporte renvoyant vers une page d'@b inscription si l'utilisateur
* non inscrit souhaite s'inscrire.
*/
require_once("inc/connectDB.php"); /** Connexion à la base de données.*/
require_once("inc/sessionUtilisateur.php"); /** Start session.*/
require_once("inc/fonctionsFichiers.php"); /** Fichiers contenant les fonctions.*/
define("CATEGORIE", "accueil");
$identifiant="";
$mot_de_passe="";
$erreur=true;
$fonction=""; /** Permet de sélectionner via le select la requête MySql adéquate.*/
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['fonction']))
{
$identifiant = trim($_POST['username']); /** Retirer les espaces vides avant et après le mot saisi.*/
$mot_de_passe = trim($_POST['password']); /** Retirer les espaces vides avant et après le mot saisi.*/
$fonction= $_POST['fonction'];
if (!preg_match('/[^@]+@[^\.]+\..+$/', $identifiant))
{
$erreur = false;
echo "No"; /** À la valeur NO correspond un message d'erreur.*/
}
if (!preg_match('/^[A-Za-z]{1,8}\d$/', $mot_de_passe))
{
$erreur = false;
echo "No"; /** À la valeur NO correspond un message d'erreur.*/
}
if($erreur==true)
{
if($fonction==1) /** 1 correspond au membre.*/
{
if (AuthentificationUtilisateur($conn, $identifiant, $mot_de_passe)==1)
{
$infoMembre = lireUtilisateur($conn, $identifiant);
$_SESSION['nom'] = $infoMembre[0]['nom_utilisateur'];
$_SESSION['prenom'] = $infoMembre[0]['prenom_utilisateur'];
$_SESSION['id_utilisateur'] = $infoMembre[0]['id_utilisateur'];
$_SESSION['identifiant_utilisateur'] = $identifiant;
echo "01"; /** 01 correspond au membre.*/
}
else
{
echo "No"; /** À la valeur NO correspond un message d'erreur.*/
}
}
if($fonction==2) /** 2 correspond à l'animateur.*/
{
if(AuthentificationGestionnaire($conn, $identifiant, $mot_de_passe, $fonction) === 1)
{
$infoAnimateur = lireGestionnaire($conn, $identifiant);
$_SESSION['nom'] = $infoAnimateur[0]['nom'];
$_SESSION['prenom'] = $infoAnimateur[0]['prenom'];
$_SESSION['id_utilisateur'] = $infoAnimateur[0]['idgestions'];
$_SESSION['identifiant_teacher'] = $identifiant;
$identifiant="";
$mot_de_passe="";
echo "02"; /** 02 correspond au moniteur.*/
}
else
{
echo "No"; /** À la valeur NO correspond un message d'erreur.*/
}
}
if($fonction==3) /** 3 correspond à l'animateur.*/
{
if(AuthentificationGestionnaire($conn, $identifiant, $mot_de_passe, $fonction) === 1)
{
$_SESSION['identifiant_admin'] = $identifiant;
$identifiant="";
$mot_de_passe="";
echo "03"; /** 03 correspond à l'administrateur.*/
}
else
{
echo "No"; /** À la valeur NO correspond un message d'erreur.*/
}
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<?php require_once("head.php");?> <!-- head -->
<title>NDG-Accueil</title>
</head>
<body>
<header>
<?php require_once("header.php");?> <!-- header -->
</header>
<div class="modal fade " id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content border-0 rounded-0">
<div class="modal-header rounded-0">
<h5 class="modal-title" id="exampleModalCenterTitle">Se connecter</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span class="croix" id="croix" aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- error message field -->
<div id="message-erreur" class="message-erreur">
<p id="erreurbis2"></p>
</div> <!-- end error message field -->
<form class="formulaireindex">
<div class="form-group">
<label for="exampleInputEmail1">Courriel</label>
<input type="email" name="username" id="username" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="john2@exemple.com" required autofocus>
<small id="emailHelp" class="form-text text-muted">Nous garantissons la confidentialité de votre courriel.</small>
</div>
<div class="form-group">
<label class="tootip" for="exampleInputPassword1">Mot de passe<i id="tootip" class="fas fa-question-circle mx-2"></i></label>
<span class="content-tooltip">8 lettres minuscules max. suvi d'un chiffre max.</span>
<input type="text" name="password" id="password" class="form-control" id="exampleInputPassword1" placeholder="Exemple : john2" required>
</div>
<div class="form-group">
<label for="exampleInputSelect1">Identifiez-vous</label>
<select name="fonction" id="fonction" class="custom-select" id="exampleInputSelect1">
<option value="1">Membre du club</option>
<option value="2">Moniteur de sport</option>
<option value="3">Administrateur du site</option>
</select>
</div>
<div class="centrer-bouton">
<button type="button" name="envoi" id="envoyer" class="btn btn-sm text-white">Envoyer</button>
</div>
</form> <!-- end form -->
</div> <!-- end modal body -->
<div class="modal-footer text-white">
<a class="text-white" id="bouton-onglet" href="inscription.php"><i class="fas fa-user-alt mr-2"></i>S'inscrire</a>
</div> <!-- end footer modal -->
</div> <!-- end modal content -->
</div> <!-- end modal wrapper -->
</div> <!-- end modal main container -->
<div class="container-fluid">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol> <!-- end carousel indicators -->
<div class="carousel-inner ">
<div class="carousel-item active">
<img class="d-block w-100 h-100" src="images/action-athlete-blue-863988R.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100 h-100" src="images/balance-beach-exercise-317157RRRRR.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100 h-100" src="images/action-athlete-barbell-841130R.jpg" alt="Third slide">
</div>
</div> <!-- end carousel inner -->
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span> <!-- left control carousel -->
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span> <!-- right control carousel -->
<span class="sr-only">Next</span>
</a>
</div> <!-- end carousel container -->
<section>
<h1 class="text-center" id="activites">Activités sportives</h1>
<p class="text-center">Le Club NDG compte les meilleurs professionnels pour vous offrir des activités sportives de qualité. En nous rejoignant, vous bénéficierez d'installations modernes et de l'encadrement d'un personnel tout entier dévoué à ce que chez nous, vous vous sentiez chez vous.</p>
<div class="row">
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 text-center">
<div class="card-header">Yoga</div>
<img class="card-img-top rounded-0" src="./images/card_yoga.jpg" alt="image yoga">
<div class="card-body">
<p class="card-text">Offrez-vous des plages relaxation avec notre animateur de yoga.</p>
<a class="nav-link" href="yoga.php"><button type="button" class="btn text-white bouton-card">Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 1 -->
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 text-center">
<div class="card-header">Musculation</div>
<img class="card-img-top rounded-0" src="./images/card_musculation%20copie.jpg" alt="image Musculation">
<div class="card-body">
<p class="card-text">Venez profiter de nos équipements de musculation de qualité.</p>
<a class="nav-link " href="musculation.php"><button type="button" class="btn text-white bouton-card"> Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 2 -->
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 text-center">
<div class="card-header">Natation</div>
<img class="card-img-top rounded-0" src="./images/card_natation.jpg" alt="image natation">
<div class="card-body ">
<p class="card-text">Envie de faire des longueurs ? Nos bassins n'attendent que vous !</p>
<a class="nav-link " href="natation.php"><button type="button" class="btn text-white bouton-card"> Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 3 -->
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 text-center">
<div class="card-header">Tennis</div>
<img class="card-img-top rounded-0" src="./images/card_tennis.jpg" alt="Card image tennis">
<div class="card-body">
<p class="card-text">Vous adorerez nos courts et les conseils de notre professeur.</p>
<a class="nav-link " href="tennis.php"><button type="button" class="btn text-white bouton-card"> Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 4 -->
<div class="col-lg-4 col-md-6 mb-4">
<div class=" card h-100 text-center">
<div class="card-header">Basketball</div>
<img class="card-img-top rounded-0" src="./images/card_basket.jpg" alt="image Basketball">
<div class="card-body">
<p class="card-text">Nos équipes de soccer attendent que de nouvelles recrues arrivent.</p>
<a class="nav-link " href="basketball.php"><button type="button" class="btn text-white bouton-card"> Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 5 -->
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 text-center ">
<div class="card-header ">fitness</div>
<img class="card-img-top rounded-0" src="./images/card_fitness.jpg" alt="image fitness">
<div class="card-body">
<p class="card-text">Désir de se remettre en forme, nos cours de fitness sont faits pour vous.</p>
<a class="nav-link " href="fitness.php"><button type="button" class="btn text-white bouton-card"> Plus d'infos</button></a>
</div>
</div> <!-- end card wrapper -->
</div> <!-- end card container number 6 -->
</div> <!-- end card row wrapper -->
</section> <!-- end card section activity -->
<aside>
<div class="card img-fluid aside">
<img class="card-img-top" src="./images/a-young-woman-in-head-to-knee-forward-bend-yoga-pose.jpg" alt="yoga image" style="width:100%">
<div class="card-img-overlay col-sm-12 col-md-12 col-lg-12 mx-auto">
<h2 class="card-title text-center">Inscrivez-vous à notre infolettre</h2>
<p class="text-center">Soyez tout de suite informé des dernières nouvelles du club.</p>
<div class="input-group ">
<input type="text" class="form-control" placeholder="Votre courriel" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<span class="input-group-text text-white" id="basic-addon2">S'abonner</span>
</div>
</div> <!-- end of input container -->
</div> <!-- end of overlay container -->
</div> <!-- end of aside container -->
</aside>
</div> <!-- end of main wrapper -->
<footer>
<?php require_once("footer.php");?> <!-- footer -->
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="js/index.js"></script>
</body>
</html>