-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodify.php
40 lines (32 loc) · 1.12 KB
/
modify.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
<?php
$pageTitle = 'Modifier mot de passe';
include 'inc/header.php';
include_once 'lib/UserManager.class.php';
if(!isset($_SESSION['email'])) {
header("Location: authentification.php");
}
?>
<div class="login">
<h4>Modifier mot de passe</h4>
<?php include 'inc/messages.php'; ?>
<form class="" action="modify.php" method="post">
<input type="text" name="email" value="<?php echo $_SESSION['email'];?>" ></input>
<input name='pw' placeholder='Nouveau mdp' type='password'></input>
<input name='pw2' placeholder='Nouveau mdp (encore)' type='password'></input>
<div class="espace"></div>
<input type="submit" name="submit" value="Confirmer" class="animated"></input>
</form>
</div>
<?php
if(isset($_POST['submit'])) {
$pw = $_POST['pw'];
$pw2 = $_POST['pw2'];
$email = $_POST['email'];
$bdd = Connection::getInstance('localhost', 'todolister', 'utf8', 'root', '');
$obj1 = new UserManager($bdd);
$_SESSION['location'] = 'Location:modify.php';
$user1 = $obj1->update($email, $pw, $pw2);
echo $user1;
}
?>
<?php include('inc/footer.php'); ?>