This repository has been archived by the owner on Jul 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinscription.php
executable file
·147 lines (136 loc) · 4.04 KB
/
inscription.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Vérification</title>
<style>
@font-face {
font-family: "cairo";
src: url('fonts/Cairo-SemiBold.ttf')
}
* {
font-family: "cairo";
}
body {
margin: 0;
}
body>div#main {
text-align: center;
height: 100vh;
padding: 50px;
}
div.return {
margin-top: 50px;
}
div#note {
text-align: left;
max-width: 500px;
min-width: 400px;
margin: auto;
margin-top: 26px;
border-left: 5px #ff5516 solid;
padding: 20px 10px;
background-color: #edf7c4;
}
.return>a {
text-decoration: none;
color: black;
padding: 2px 10px;
margin: 36px 0 0;
border-radius: 6px;
border: 1px solid #0006;
background-color: #f6f6f6;
}
.return>a:hover {
background-color: #e6e6e6;
}
</style>
</head>
<body>
<?php
require_once 'root.php';
$success = false;
if (isset($_POST['nom']) && isset($_POST['prenom']) &&
isset($_POST['daten']) && isset($_POST['lieun']) &&
isset($_POST['email']) && isset($_POST['pass']) &&
isset($_POST['tel']) && isset($_POST['nationalite']) &&
isset($_POST['pays']) && isset($_POST['adresse']) &&
isset($_POST['theme'])
) {
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$daten = $_POST['daten'];
$lieun = $_POST['lieun'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$tel = $_POST['tel'];
$nationalite = $_POST['nationalite'];
$pays = $_POST['pays'];
$adresse = $_POST['adresse'];
$theme = $_POST['theme'];
// check email and phone number if already exist in our database: stop registration, else continue.
$result = $connection->query("SELECT mat FROM etudiant WHERE email='$email' OR tel='$tel'");
if (!$result->num_rows) {
// insert new user.
$result = $connection->query("INSERT INTO etudiant VALUES(
NULL, '$nom', '$prenom', '$daten', '$lieun', '$email', '$pass', '$tel', '$nationalite',
'$pays', '$adresse', 'att', null, $theme
)");
if ($result) {
// inserting new user successfully.
$success = true;
$successmsg = <<< _SUCCESS_MSG
<div>Félicitations $nom! Votre compte a été crée.</div>
<div id="note">
<span style="background-color: #ff5516;"> Note: </span>
Cet compte va être supprimer automatiquement si vous avez été réfusés
ou après la réalisation de concours.
</div>
_SUCCESS_MSG;
} else {
// inserting new user failed.
$success = false;
$failmsg = <<< _FAIL_MSG
<div>Désolé, on a un problème unconnue pour le moment, reéssayer après un moment.</div>
_FAIL_MSG;
}
} else {
// email/tel already exists on the database.
$success = false;
$failmsg = <<< _FAIL_MSG
<div>Désolé, cet e-mail ou/et téléphone a déjà utilisé.</div>
_FAIL_MSG;
}
} else {
// didn't enter all required informations.
$success = false;
$failmsg = <<< _FAIL_MSG
<div>Désolé, vous devez remplir tous les informations nécessaires pour l'inscription .</div>
_FAIL_MSG;
}
if ($success) {
echo <<< _BEGIN
<div id="main" style="background-color: #deffe0;">
<div><img src="img/success.png" alt="Success" style="width: 180px;"></div>
_BEGIN;
echo $successmsg;
echo <<< _END
<div class="return"><a href=".">returnez à la page principale</a></div>
</div>
_END;
} else {
echo <<< _BEGIN
<div id="main" style="background-color: #fff5f1;">
<div><img src="img/fail.png" alt="Failed" style="width: 180px;"></div>
_BEGIN;
echo $failmsg;
echo <<< _END
<div class="return"><a href="inscription-etudiant.php">returnez à la page d'inscription</a></div>
</div>
_END;
}
?>
</body>
</html>