-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathotp.php
36 lines (32 loc) · 1.1 KB
/
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
<?php
session_start();
$otpError = array('otp-error' => '');
if (isset($_SESSION['code'])) {
if (isset($_POST['submit'])) {
if (empty($_POST['one_time'])) {
$otpError['otp-error'] = "Enter Otp Code";
} else {
if ($_SESSION['code'] == $_POST['one_time']) {
header("Location: index.php");
} else {
$otpError['otp-error'] = "Invalid Code Enter";
}
}
}
} else {
$otpError['otp-error'] = "One time Password has Expired";
}
?>
<?php include "templates/header.php" ?>
<section class="bg-white shadow-sm container-extra p-3" style="margin-top: 17rem;">
<?php if ($otpError['otp-error']) : ?>
<div class=" alert alert-danger">
<?php echo $otpError['otp-error']; ?>
</div>
<?php endif; ?>
<form action="" method="POST">
<input type="text" class="form-control mb-3" placeholder="Enter OTP" name="one_time">
<button class="btn btn-secondary col-12" name="submit" type="submit">Verify Code</button>
</form>
</section>
<?php include "templates/footer.php" ?>