-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobileverification.php
113 lines (70 loc) · 2.89 KB
/
mobileverification.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
<?php
if(isset($_POST['sendotp'])) {
require('include/textlocal.class.php');
//require('include/credential.php');
$textlocal = new Textlocal(false, false,'WaQKeYacIcQ-dJK6zYl4vEkDi9QG6CLeKOvSlzdzFe');
// You can access MOBILE from credential.php
// $numbers = array(MOBILE);
// Access enter mobile number in input box
$numbers = array($_POST['C_mobileno']);
$sender = 'TXTLCL';
$otp = mt_rand(10000, 99999);
$message = "Hello " . $_GET['c_name'] . " This is your OTP: " . $otp;
try {
$result = $textlocal->sendSms($numbers, $message, $sender);
setcookie('otp', $otp);
echo "OTP successfully send..";
} catch (Exception $e) {
die('error: ' . $e->getMessage());
}
}
if(isset($_POST['verifyotp'])) {
$otp = $_POST['otp'];
if($_COOKIE['otp'] == $otp) {
echo "Congratulation, Your mobile is verified.";
} else {
echo "Please enter correct otp.";
}
}
?>
<!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.0">
<title>mobile verification</title>
<?php include('include/common_css.php') ;?>
<script type="text/javascript">
function func1(){
var value=document.getElementById("otpvalue");
var valuebtn=document.getElementById("verifybtn");
value.style.visibility="visible";
valuebtn.style.visibility="visible";
}
</script>
</head>
<body>
<?php include('include/header_1.php'); ?>
<div class="col-lg-6" style="margin-top:10%; margin-left:25%;">
<div>
<center> <h3>Real Time User Verification/Authentication</h3></center> <br>
</div>
<form action="userdashboard.php" method="post" >
<div class="form-group">
<label for="">Enter Mobile number </label>
<input type="text" name="C_mobileno" value="<?php echo $_SESSION['c_mobile'];?>" class="form-control" disabled>
</div>
<div class="form-group">
<label for="">To verify mobile number click to send OTP button </label>
</div>
<button type="submit" name="sendotp" value="sendotp" onclick="func1()" id="sendotpbtn" class="btn btn-info">SEND OTP</button>
<div class="form-group">
<br>
<input type="text" name="enteredotp" class="form-control" id="otpvalue" placeholder="Enter OTP to verify" >
</div>
<button type="submit" name="verifyotp" value="verifyotp" class="btn btn-success" id="verifybtn">VERIFY</button>
</form>
</div>
</body>
</html>