-
Notifications
You must be signed in to change notification settings - Fork 4
/
resetpassword.php
95 lines (85 loc) · 3.85 KB
/
resetpassword.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
<?php
require('database.php');
if (isset($_GET['id']) && isset($_GET['code'])) {
$id = base64_encode($_GET['id']);
$code = $_GET['code'];
$stmt = $db->prepare("SELECT * FROM members WHERE id=:uid AND token=:token");
$stmt->execute(array(":uid" => $id, ":token" => $code));
$rows = $stmt->fetch(PDO::FETCH_ASSOC);
if ($stmt->rowCount() == 1) {
if (isset($_POST['btn-reset-pass'])) {
$pass = $_POST['pass'];
$cpass = $_POST['confirm-pass'];
if ($cpass !== $pass) {
$msg = "<div class='alert alert-warning'>
<button class='close' data-dismiss='alert'>×</button>
<strong>HATA!</strong> Şifreler Uyuşmuyor.
</div>";
} else {
$password = password_hash($cpass, PASSWORD_DEFAULT);
$stmt = $db->prepare("UPDATE members SET password=:upass WHERE id=:uid");
$stmt->execute(array(":upass" => $password, ":uid" => $rows['id']));
$msg = "<div class='alert alert-success'>
<button class='close' data-dismiss='alert'>×</button>
Şifre Değiştirildi.Yönlendiriliyorsunuz
</div>";
header("refresh:5; url=login.php");
}
}
} else {
$msg = "<div class='alert alert-alert-danger'>
<button class='close' data-dismiss='alert'>×</button>
Böyle bir hesap bulunamadı
</div>";
}
}
?>
<!DOCTYPE html>
<html lang="TR">
<head>
<meta charset='utf-8'>
<title>Şifreni Sıfırla</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="inc/main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<div class="row main">
<div class="main-login main-center">
<strong>Merhaba !</strong> <?php echo htmlentities($rows['username']) ?> Sanırım Şifreni unuttun :)
<form class="form-signin" method="post">
<hr/>
<?php
if (isset($msg)) {
echo $msg;
}
?>
<label for="pass" class="cols-sm-2 control-label">Şifre</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-lg"></i></span>
<input type="password" class="form-control" placeholder="Yeni Şifreniz" name="pass" required/>
</div>
</div> <br/>
<label for="confirm-pass" class="cols-sm-2 control-label">Şifre Tekrar</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-lg"></i></span>
<input type="password" class="form-control" placeholder="Yeni Şifre Tekrarı" name="confirm-pass" required/>
</div>
</div>
<hr/>
<button class="btn btn-primary btn-lg btn-block login-button" type="submit" name="btn-reset-pass">Şifreyi Sıfırla
</button>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
</body>
</html>