-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenterforget-otp.php
68 lines (52 loc) · 1.67 KB
/
enterforget-otp.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
<?php
require_once('views/header.php');
if($_SESSION['validate'] != "forget-otp"){
header('Location:forget-otp.php');
}
$_SESSION['validate'] = "enterforget-otp";
$email="";
$error="";
?>
<body class=" d-flex flex-column">
<script src="./dist/js/demo-theme.min.js?1674944402"></script>
<div class="page page-center">
<div class="container container-tight py-4">
<form class="card card-md" action="" method="POST" autocomplete="off" novalidate>
<div class="card-body">
<h2 class="card-title text-center mb-4">Verification</h2>
<div class="mb-3">
<label class="form-label">OTP Code</label>
<input type="text" class="form-control" placeholder="Enter OTP Code" name="otp">
</div>
<div class="form-footer">
<input type="submit" class="btn btn-primary w-100" value="Verify">
</div>
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$totp = $_POST['otp'];
$email = $_SESSION['email'];
$sql = "SELECT otp FROM user WHERE email='$email'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$otp= $row['otp'];
if ($totp == $otp){
$sql= "UPDATE user SET status=1 WHERE email='$email'";
$result = $conn->query($sql);
header('Location: forget-password.php');
}else{
$error="Invlid OTP";
}
};?>
<ul style="list-style-type: none;">
<li style="color:red;"><?php echo $error; ?></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require_once('views/footer.php');
?>