-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.php
More file actions
60 lines (53 loc) · 2.29 KB
/
example.php
File metadata and controls
60 lines (53 loc) · 2.29 KB
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
<?php
require_once 'core/init.php';
if(!Input::exists()){
?>
<form method="post" action="index.php">
<input type="text" maxlength="10" placeholder="Enter Mobile Number" name="mobile"><br/>
<input type="submit" value="Send OTP">
</form>
<?php
}
else if(Input::exists() && Input::get('mobile')!=''){
$otp = new OTP(8,4); // defining length and strength of the OTP CODE!!
//GET the OTP Code in $code;
$code = $otp->getOTPCode();
//Form the contents of the text message that needs to be send!
$message = "Your OTP is : $code ";
if($otp->send(Input::get('mobile'), $message) && Session::loginAttempt('OTP')){
Session::put('OTP Sending', 'OTP Sent Successfully');
Redirect::to('example.php');
}
else{
echo "OTP Sending Error ... login attempt = " . Session::loginAttempts('OTP');
}
}
if(Session::exists('OTP Sending')){
echo Session::get('OTP Sending') . "<br/>";
Session::delete('OTP Sending');
if(Session::loginAttempts('OTP')){
?>
<form action="example.php" method="post">
<input type="text" maxlength="8" placeholder="Enter OTP Here" name="OTP_response_code">
<input type="submit" Value="Verify">
</form>
<?php
}
else{
echo 'You have been blocked.. contact Administrator';
}
}
if(Input::exists() && Input::get('OTP_response_code')!=''){
$otp=new OTP();
if($otp->verifyOTP(Input::get('OTP_response_code'))){
Session::deleteloginAttempt('OTP');
echo 'Yipppeeee Verified';
}
else{
Session::put('OTP Sending', 'Incorrect, Enter Again');
if(Session::loginAttempt('OTP')){
Redirect::to('index.php');
}
}
}
?>