-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgotpass.php
81 lines (60 loc) · 1.97 KB
/
forgotpass.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
<?php
include "connection.php";
session_start();
$uname=$_POST["name"];
$uname=mysqli_real_escape_string($con,$uname);
$query="select * from user where username='$uname'";
$result=mysqli_query($con,$query);
$count=mysqli_num_rows($result);
if($count == 1)
{
$_SESSION['frgtuser']=$uname;
$query1="select question from user where username='$uname'";
$result1=mysqli_query($con,$query1);
$row=mysqli_fetch_assoc($result);
echo "
<script>
document.getElementById('frgt').readOnly=true;
</script>
<form id='frgtfrm' method='POST'>
<div class='input-group mb-3 form-group'>
<div class='input-group-prepend'>
<span class='input-group-text'>Question</span>
</div>
<input type='text' id='frgtques' name='forgotusername' class='form-control' value='".$row['question']."' readonly>
</div>
<div class='input-group mb-3 form-group'>
<div class='input-group-prepend'>
<span class='input-group-text'>Answer</span>
</div>
<input type='text' id='answer' name='answer' class='form-control' required>
</div>
</form>
<div class='justify-content-center' id='resp'>
<button type='submit' name='changepassbtn' onclick='checkyy()' class='btn btn-primary'>Submit</button>
</div>
";
}
else
{
echo '
<div class=" justify-content-center">
<button type="submit" id="forgotbtn" name="forgotbtn" onclick="check()" class="btn btn-primary">Submit</button>
</div>';
echo "Invalid username.";
}
?>
<script>
function checkyy()
{
var ans= document.getElementById("answer").value;
$.ajax({
url: 'forgotpass1.php',
type: 'post',
data: {ans},
success: function(response){
$("#resp").html(response);
}
});
}
</script>