-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuserSettings.php
208 lines (199 loc) · 9.85 KB
/
userSettings.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
<?php
include "header.php";
require_once "conf.inc.php";
require_once "functions.php";
if (isConnected()) {
if (!empty($_SESSION["token"])) {
$member = getInfo('*');
}
if ($member['member_picture'] == null){
if ($member['gender'] == 2){
$default = 'img/default/default_girl.jpg';
}else{
$default = 'img/default/default_boy.jpg';
}
}
?>
<div class="container">
<div id="profile-picture" class="">
<img class="profile-picture" src="<?php echo ($member['member_picture'] != null)?'upload/'.$member['member_picture']:$default ?>"
alt="profile picture">
<form action="script/updatePicture.php" method="POST" enctype="multipart/form-data">
<div class="form-group row">
<input type="file" name="newPicture" class="form-control-file">
<input type="submit" name="updatePicture" class="btn btn-primary">
</div>
</form>
</div>
</div>
<div class="container container-fluid">
<div id="information">
<h2>Changer vos informations</h2>
<div class="mr-auto ml-auto">
<form method="POST" action="script/updateUser.php">
<table class="mr-auto ml-auto">
<tr>
<td>
<?php
if (isset($_SESSION["errorFormInfo"])) {
foreach ($_SESSION["errorFormInfo"] as $keyError) {
echo "<li style = 'color:red'>" . $listOfErrorsInfo[$keyError] . "</li>";
}
unset($_SESSION["errorFormInfo"]);
} ?>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label for="lastname">Nom</label>
<input type="text" class="form-control" name="lastname"
value="<?php echo $result["member_lastname"] ?>">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label for="firstname">Prénom</label>
<input type="text" class="form-control" name="firstname"
value="<?php echo $result["member_firstname"] ?>">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label for="email">Email</label>
<input type="email" class="form-control" name="email"
value="<?php echo $result["member_email"] ?>">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label for="address">Adresse</label>
<input type="text" class="form-control" name="address"
value="<?php echo $result["member_address"] ?>">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label for="zipcode">Code postal</label>
<input type="text" class="form-control" name="zipcode"
value="<?php echo $result["member_zip_code"] ?>">
</div>
</td>
</tr>
<tr>
<td>
<button type="submit" style="margin-top: 10%; margin-bottom: 10%"
class="btn btn-primary">
Actualiser le profil
</button>
</td>
</tr>
</table>
<?php unset($_SESSION['postFormInfo']); ?>
</form>
</div>
<div id="password">
<h2>Changer votre mot de passe</h2>
<div class="mr-auto ml-auto">
<form method="POST" action="script/changePwd.php">
<table class="ml-auto mr-auto">
<tr>
<td>
<?php
if (isset($_SESSION["errorFormPwd"])) {
foreach ($_SESSION["errorFormPwd"] as $keyError) {
echo "<li style = 'color:red'>" . $listOfErrorsPwd[$keyError] . "</li>";
}
unset($_SESSION["errorFormPwd"]);
} ?>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label>MOT DE PASSE ACTUEL</label>
<input type="password" class="form-control" name="oldPwd">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label>NOUVEAU MOT DE PASSE</label>
<input type="password" class="form-control" name="newPwd">
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group ml-auto mr-auto">
<label>CONFIRMER MOT DE PASSE</label>
<input type="password" class="form-control" name="confirmNewPwd">
</div>
</td>
</tr>
<tr>
<td>
<button type="submit" style="margin-top: 7%; margin-bottom: 10%"
class="btn btn-primary">Changer le mot de passe
</button>
</td>
</tr>
</table>
<?php unset($_SESSION['postFormPwd']); ?>
</form>
</div>
</div>
<div id="delete">
<h2>Supprimer son compte</h2>
<div class="mr-auto ml-auto">
<!-- Button trigger modal -->
<button type="button" style="margin-top: 3%; margin-bottom: 5%" class="btn btn-danger"
data-toggle="modal" data-target="#exampleModalCenter">
Supprimer le compte
</button>
<!-- POP-UP DELETE ACCOUNT -->
<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">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Supprimer le compte</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Toutes données vous concernant seront définitivement perdues.<br>
Êtes-vous sûr de vouloir supprimer votre compte?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler
</button>
<a href="script/delete-account.php">
<button type="button" class="btn btn-danger">Supprimer</button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
} else {
$_SESSION["previousLocation"] = "userSettings.php";
$_SESSION["connexionNeeded"] = "Vous devez être connecter pour accéder à cette page";
include "signup.php";
}
include_once "footer.php";
?>