-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatepassword.php
147 lines (143 loc) · 5.14 KB
/
updatepassword.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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include 'links.php'; ?>
<title>reset password | hrms</title>
<link rel="shortcut icon" href="img/icon.png" type="image/x-icon" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/login.css">
</head>
<body>
<header>
<!-- navbar section begins -->
<nav class="navbar navbar-expand-md">
<div class="container">
<a
href="index.php"
class="navbar-brand text-dark font-weight-bold"
>CustomCastle</a
>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#collapsenav"
>
<span>
<img
src="img/menuHamburger.svg"
width="35px"
height="35px"
alt="menu-hamberger-icon"
/>
</span>
</button>
<div
class="collapse navbar-collapse text-center"
id="collapsenav"
>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a href="index.php" class="nav-link text-dark"
>home</a
>
</li>
<!-- <li class="nav-item">
<a
href="#about_us"
class="nav-link text-dark"
>about us</a
>
</li>
<li class="nav-item">
<a
href="#contact_us"
class="nav-link text-dark"
>contact us</a
>
</li>-->
<li class="nav-item">
<a href="login.php" class="nav-link text-dark"
>login</a
>
</li>
<li class="nav-item signup">
<a
href="register.php"
class="nav-link text-dark"
>register</a
>
</li>
</ul>
</div>
</div>
</nav>
<!-- navbar ends -->
</header>
<!-- login script starts -->
<?php
include 'connection.php';
if($con){
if(isset($_POST['submit'])){
$pass = $_POST['pass'];
$cpass = $_POST['cpass'];
$uid = $_GET['id'];
if($pass == $cpass){
$hashpass = password_hash($pass,PASSWORD_BCRYPT);
$resetquery = "update usr_login set password = '$hashpass' where email = '$uid' ";
$reset = mysqli_query($con,$resetquery);
if($reset){
?>
<script>
alert("password updated successfully");
location.replace("login.php");
</script>
<?php
} else{
?>
<script>
alert("unable to update password!!");
</script>
<?php
}
}else{
?>
<script>
alert("confirm password doesnot match password!!");
</script>
<?php
}
}
}
?>
<!-- form starts -->
<div class="login-form">
<form action="" method="POST">
<h3>Password Recovery Wizard</h3>
<input
type="password"
name="pass"
placeholder="new password"
/><br />
<input
type="password"
name="cpass"
placeholder="confirm password"
/><br />
<input
type="submit"
name="submit"
value="update"
id="login-btn"
/><br />
</form>
</div>
<?php include 'footer.php'; ?>
</body>
</html>