-
Notifications
You must be signed in to change notification settings - Fork 0
/
password.php
163 lines (103 loc) · 5.14 KB
/
password.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
session_start();
include("connect.php");
$error="";
$success="";
if($_SESSION['Keytoq']) {
if($_POST) {
$error="";
//$success="";
$newpassword=$_POST['np'];
$confirmpassword=$_POST['cp'];
if (!$_POST["np"]){
$error.= "*Please enter the new password!<br>";
}
if (!$_POST["cp"]){
$error.= "*Please enter the confirm password!<br>";
}
if($newpassword == $confirmpassword) {
$cfp = password_hash($_POST['cp'] , PASSWORD_DEFAULT);
$query="UPDATE `Signup` SET Password='".mysqli_real_escape_string($link,$cfp)."' WHERE keytoq='".mysqli_real_escape_string($link,$_SESSION['Keytoq'])."'";
if($result=mysqli_query($link,$query)){
//echo "Password successfully updated!!!";
header("Location:index1.php");
}
} else {
$error.="*The new password and the confirm password didn't match. Please try again.";
}
}
} else {
header("Location:index1.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<title>My Journal</title>
<style type="text/css">
body{
padding:0;
margin:0;
font-family:ReithSans,Arial,Helvetica,freesans,sans-serif;
background-image:url("secret journal.jpg");
background-size:cover;
}
#headertext{
text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
text-align:center;
color:Black;
padding:5px;
}
.logout{
text-align:center;
color:black;
font-weight:bold;
margin:10px;
}
form{
background:#B2E3F0;
border:1px solid black;
border-radius:10px;
padding:20px;
}
#subheading{
color:green;
text-align:center;
text-shadow: -1px -1px 0 yellow, 1px -1px 0 yellow, -1px 1px 0 yellow, 1px 1px 0 yellow;
font-size:20px;
}
#error{
color:red;
font-size:18px;
text-align:center;
}
</style>
</head>
<body>
<div class="container">
<p class="display-4" id="headertext">My Secret Journal</p>
<p id="subheading">Please fill the following columns to change your password!</p>
<div id="error"><?php echo $error; ?></div>
<form method=post>
<div class="form-group">
<label for="np">Enter the New password</label>
<input name="np" type="password" class="form-control" id="np">
</div>
<div class="form-group">
<label for="cp">Enter the Confirm password</label>
<input name="cp" type="password" class="form-control" id="cp">
</div>
<button type="submit" id="save" class="btn btn-primary logout">Submit</button>
<a href="index1.php">Go Back to Log In page</a>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script type="text/javascript">
</script>
</body>
</html>