-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForgot password (2).php
146 lines (132 loc) · 3.47 KB
/
Forgot password (2).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
<?php
include('config.php');
$username = "";
if(isset($_POST["reset"])){
// include('config.php');
$psw = $_POST["password"];
// $token = $_SESSION['token'];
$username = $_POST['username'];
$hash = password_hash( $psw , PASSWORD_DEFAULT );
$sql = mysqli_query($conn, "SELECT * FROM register WHERE username='$username'");
$query = mysqli_num_rows($sql);
$fetch = mysqli_fetch_assoc($sql);
if($username){
$new_pass = $hash;
mysqli_query($conn, "UPDATE register SET password='$new_pass' WHERE username='$username' ");
?>
<script>
window.location.replace("login page.php");
alert("<?php echo "your password has been succesfully reset"?>");
</script>
<?php
}else{
?>
<script>
alert("<?php echo "Please try again"?>");
</script>
<?php
}
}
?>
<!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">
<title>Change Password page</title>
</head>
<body>
<h1>Customer Relationship Management System </h1>
<h3>Change Password</h3>
<div class="mainDiv">
<div class="cardStyle">
<form action="" method="post" >
<div class="box">
<br>
Email-Id: <input type="email" name="username">
</div>
<div class="box">
<br>
New Password: <input type="password" name="password">
</div>
<div class="box"> <br>
Confirm Password: <input type="password" name="cpassword">
</div>
<div>
<br>
<div class="buttonWrapper">
<button type="submit" id="submitButton1" class="submitButton" name="reset">
<span>Confirm</span>
</button>
</div>
</div>
</form>
</div>
</div>
<style>
body{
background: url("img/15_mei_8.jpg");
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
background-position: center ;
}
.mainDiv {
display: flex;
min-height: 100%;
align-items: center;
justify-content: center;
}
.cardStyle {
width: 500px;
height: 250px;
border-color: white;
background:white;
padding: 36px 0;
border-radius: 4px;
margin: 30px 0;
}
.box {
font-family: Georgia, 'Times New Roman', Times, serif;
width: 70%;
display: flex;
flex-direction: column;
margin: auto;
}
h1{position: relative;
color:black;
/* align-items: center; */
text-align:center;
/* justify-content: center; */
font-size: 40px;
/* display: flex; */
font-family: Georgia, 'Times New Roman', Times, serif;
color:black;
}
h3{
font-size: 30px;
font-family: Georgia, 'Times New Roman', Times, serif;
margin-top: 20px;
color:black;
text-align: center;
}
.buttonWrapper {
margin-top: 30px;
}
.submitButton {
width: 70%;
height: 40px;
margin: auto;
display: block;
color: black;
background-color:lightpink;
border-color:black;
border-radius: 4px;
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 18px;
cursor: pointer;
}
</style>
</body>
</html>