-
Notifications
You must be signed in to change notification settings - Fork 0
/
moncompte.php
96 lines (82 loc) · 2.37 KB
/
moncompte.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
<!DOCTYPE html>
<html>
<head>
<title>ECEpic</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="moncompte.css">
<link rel="stylesheet" type="text/css" href="menu.css">
</head>
<body onkeydown="testEchap(event)">
<?php include('menu.php'); ?>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=ecepic;charset=utf8', 'root', '');
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
?>
<?php
$requete_id_user = $bdd->prepare('SELECT ID from users WHERE pseudo = ?');
$requete_id_user->execute(array($_SESSION['user']));
$id_user = $requete_id_user->fetch();
if(isset($_POST['modifier']))
{
$req = $bdd->prepare('UPDATE users SET pseudo = :pseudo, mdp = :mdp WHERE pseudo = :ex_pseudo ');
$req->execute(array(
'pseudo' => $_POST['pseudo_mod'],
'mdp' => sha1(htmlspecialchars($_POST['mdp_mod'])),
'ex_pseudo' => $_POST['pseudo'],
));
}
?>
<div class="modi">
<h2>Modifier ses données : </h2>
<form method = "POST" action="" enctype="multipart/form-data">
<table>
<tr>
<td>
<label>Ancien Pseudo :</label>
</td>
<td>
<input type="text" name="pseudo" placeholder="Votre ancien pseudo"/>
</td>
</tr>
<tr>
<td>
<label>Nouveau Pseudo :</label>
</td>
<td>
<input type="text" name="pseudo_mod" placeholder="Votre nouveau pseudo"/>
</td>
</tr>
<tr>
<td>
<br/><label>Ancien Mot de passe :</label>
</td>
<td>
<input type="password" name="mdp" />
</td>
</tr>
<tr>
<td>
<br/><label>Nouveau Mot de passe :</label>
</td>
<td>
<input type="password" name="mdp_mod" />
</td>
</tr>
<tr>
<td></td>
<td>
<input value="modifier" type="submit" name="modifier"/>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>