forked from thegr8dev/doctorpatientportal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgetprocess2.php
121 lines (108 loc) · 3.79 KB
/
forgetprocess2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Reset your password</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<?php
if(isset($_POST['btn_sub'])){
$email = $_POST['getdemail'];
$ques = $_POST['getques'];
$answer = $_POST['getans'];
include('includes/conn.php');
$q = "SELECT * FROM doctor where email = '$email' ";
$r = mysqli_query($con,$q);
while($row = mysqli_fetch_assoc($r)){
$setques = $row['squestion'];
$setanswer = $row['answer'];
}
if($ques == $setques && $answer == $setanswer){
?>
<div class="container">
<center>
<br>
<div style="font-family:calibri; font-size:14px; width:60%;" class="panel panel-default">
<div class="panel-body">
<div class="alert alert-success">
<b>You Successfully verified ! Reset the password below</b>
</div>
<form action="forgetprocess3.php" id="form1" method="POST">
<input type="hidden" value="<?php echo $email;?>" name="getdocemail">
<input type="password" name="newpass" placeholder="Enter new password" required class="form-control">
<br>
<input type="password" name="cnfpass" placeholder="Confirm new password" required class="form-control">
<br>
<input type="submit" name="btn_up" value="Reset Password" class="btn btn-primary"/>
<input type="button" value="Reset" onclick="rset()" class="btn btn-danger">
</form>
</div>
</div>
</center>
</div>
<?php
}else{
echo "<div align='center' class='alert alert-danger'>Sorry Wrong Answer</div>";
}
}elseif(isset($_POST['btn_psub'])){
$email = $_POST['getdemail'];
$ques = $_POST['getques'];
$answer = $_POST['getans'];
include('includes/conn.php');
$q = "SELECT * FROM patient where email = '$email' ";
$r = mysqli_query($con,$q);
while($row = mysqli_fetch_assoc($r)){
$setques = $row['question'];
$setanswer = $row['answer'];
}
if($ques == $setques && $answer == $setanswer){
?>
<div class="container">
<center>
<br>
<div style="font-family:calibri; font-size:14px; width:60%;" class="panel panel-default">
<div class="panel-body">
<div class="alert alert-success">
<b>You Successfully verified ! Reset the password below</b>
</div>
<form action="forgetprocess3.php" id="form2" method="POST">
<input type="hidden" value="<?php echo $email;?>" name="getpemail">
<input type="password" name="newpass" placeholder="Enter new password" required class="form-control">
<br>
<input type="password" name="cnfpass" placeholder="Confirm new password" required class="form-control">
<br>
<input type="submit" name="btn_pp" value="Reset Password" class="btn btn-primary"/>
<input type="button" value="Reset" onclick="rsett()" class="btn btn-danger">
</form>
</div>
</div>
</center>
</div>
<?php
}else{
echo "<div align='center' class='alert alert-danger'>Sorry Wrong Answer</div>";
}
}
else{
echo "<div align='center' class='alert alert-danger'>Invalid Action</div>";
}
?>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
function rset(){
document.getElementById("form1").reset();
}
function rsett(){
document.getElementById("form2").reset();
}
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>