-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfp3.php
52 lines (39 loc) · 1.06 KB
/
fp3.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
<html>
<head>
<title>AnsCHECK</title>
<?php
session_start();
if ( isset( $_SESSION['user_id'] ) ) {
$idh=$_SESSION['user_id'];
echo $idh;
} else {
header("Location:login.php");
}
function error(){
echo"<script type='text/javascript'> alert('Wrong Answer!!');window.location.replace('login.php');</script>";
die();
}
?>
</head>
<body>
<?php
include 'connection.php';
$answer=$_POST['answer'];
$sql = "SELECT answer FROM login where username='$idh'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$ans=$row["answer"];
}
if(strcmp($answer,$ans)==0)
{
echo "<script type='text/javascript'> window.location.replace('changePass.php');</script>";
}
else{
session_unset();
session_destroy();
error();
}
$conn->close();
?>
</body>
</html>