-
Notifications
You must be signed in to change notification settings - Fork 0
/
modifpwd.php
65 lines (52 loc) · 2.01 KB
/
modifpwd.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
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<Title>AUTHENTIFICATION</Title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container">
<header>
<h1 class="text-center">AUTHENTIFICATION</h1>
<header>
<form action='#' method='POST'>
<div class="form-group">
<input type="password" name="password" class="form-control" id="password" placeholder="Entrer votre nouveau mot de pass">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" name="connexion" class="btn btn-primary">Connexion</button>
</div>
</form>
<?php
if (isset ($_POST['connexion']))
{
$fp =fopen('newuser.txt','r');
$dl=fopen('delete.txt','w');
$password=$_POST['password'];
$lp=false;
while (!feof($fp)){
$ligne=trim(fgets($fp));
$user=explode(",",$ligne);
if($user[0]==$_SESSION['login']){
$user[6]=$password;
}
$modif=$user[0].",".$user[1].",".$user[2].",".$user[3].",".$user[4].",".$user[5].",".$user[6]."\n";
$newline=$newline.$modif;
}
fputs($dl,trim($newline));
fclose($fp);
fclose($dl);
$fp='newuser.txt';
$dl='delete.txt';
unlink($fp);
rename($dl,$fp);
}
?>
</body>
</html>