-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion.php
59 lines (48 loc) · 1.7 KB
/
question.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="style/style.css" media="screen" />
<title>login</title>
</head>
<body>
<div id="wrapper">
<?php include('includes/header.php'); ?>
<?php include('includes/nav.php'); ?>
<div id="content">
<?php include('includes/footer.php'); ?>
</div>
</div> <!-- End #wrapper -->
</body>
</html>
<?php
session_start();
$securequestion=$_POST['securequestion'];
$answer=$_POST['answer'];
if ($securequestion&&$answer) {
$connect = mysql_connect('localhost', 'root', '') or die('Couldnt connect to database');
mysql_select_db('login') or die('Couldnt find database');
$query = mysql_query("SELECT * FROM users WHERE securequestion='$securequestion' and answer='$answer'");
$numrows = mysql_num_rows($query);
if ($numrows != 0) {
while ($row = mysql_fetch_assoc($query)) {
$dbsecurequestion = $row['securequestion'];
$dbanswer = $row['answer'];
$dbid=$row['id'];
$username=$row['username'];
$password=$row['password'];
}
if ($securequestion == $dbsecurequestion&&$answer == $dbanswer) {
echo "Successful. Your password is:".$password;
echo "your username is:".$username;
} else {
echo "Incorrect answer";
}
}
} else {
die('Please enter an answer');
}
?>