-
Notifications
You must be signed in to change notification settings - Fork 0
/
otp.php
86 lines (85 loc) · 1.7 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
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
<!-- 2/3 -->
<?php
session_start();
if(isset($_SESSION['rand'])){
$x=$_SESSION['rand'];
echo "<script>alert('OTP = $x')</script>";
//unset($_SESSION['rand']);
}
else {
//echo "<script>alert('Session is NOT set')</script>";
header('location:signup.php');
}
//echo "<script>alert('OTP = $x')</script>";
//echo $x;
?>
<style type="text/css">
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container{
background: #f2f2f2;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.box{
background: #fff;
padding: 1.5em 2em;
box-shadow: 0 3px 7px rgba(0,0,0,.3);
}
.box h1{
text-decoration: underline red;
padding-bottom: .5em;
}
input{
padding: .5em;
}
.btn{
border: 2px solid black;
border-radius: 5px;
box-shadow: 0 3px 7px rgba(0,0,0,.3);
background: #f2f2f2;
padding: .5em 1em;
}
.btn:hover{
background: #000;
color: #fff;
}
</style>
<div class="container">
<div class="box">
<h1>Enter OTP</h1>
<form method="POST" autocomplete="off">
OTP<br>
<input type="text" name="otp" placeholder="Enter OPT" required="required"><br><br>
<input class="btn" type="submit" name="verify" value="Verify"><br><br>
</form>
<?php
if(isset($_POST['verify']))
{
$pass=$_POST['otp'];
if($pass!="")
{
if($x==$pass)
{
echo "<script>alert('OTP = $x')</script>";
unset($_SESSION['rand']);
header('location:newpass.php');
}
else
{
echo "<font color='red'>✘ </font>Wrong OTP";
}
}
else
{
echo "<font color='red'>✘ </font>All fields are required";
}
}
?>
</div>
</div>