-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQ.php
153 lines (95 loc) · 4.65 KB
/
Q.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
<?php
session_start();
include("connect.php");
if($_SESSION['emailid']) {
$query="SELECT `question` FROM `Signup` where Email='".mysqli_real_escape_string($link,$_SESSION['emailid'])."'";
if($result=mysqli_query($link,$query)) {
$row=mysqli_fetch_array($result);
//echo $row[0];
}
} else {
header("Location:index1.php");
}
if($_POST) {
$error="";
$question=$_POST['question'];
$_SESSION['Keytoq']=$question;
$query="SELECT `keytoq` FROM `Signup` where Email='".mysqli_real_escape_string($link,$_SESSION['emailid'])."'";
if($result=mysqli_query($link,$query)) {
$row1=mysqli_fetch_array($result);
//echo $row1[0];
if($row1[0]==$question) {
header("Location:password.php");
} else {
$error.="*Wrong answer. Please try again.";
}
}
}
?>
<!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 answer the following security question to change your password!</p>
<div id="error"><?php echo $error; ?></div>
<form method=post>
<div class="form-group">
<label for="question"><?php echo $row[0]; ?></label>
<input name="question" type="text" class="form-control" id="question">
</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>