-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendverifyotp.php
More file actions
161 lines (118 loc) · 3.78 KB
/
sendverifyotp.php
File metadata and controls
161 lines (118 loc) · 3.78 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
session_start();
include('connect.php');
?>
<html class="fixed">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="AMC Management System">
<meta name="author" content="Xlink Software Drome">
<title>Customer Login | <?php echo SITE_NAME; ?> </title>
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<head>
<?php
include('config.php');
include("headcssjs.php");
?>
</head>
<script src="source/alert/dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="source/alert/dist/sweetalert.css">
<?php
$authkey = authkey;
$senderid = senderid;
if(isset($_POST['verifyotp']))
{
$custmbno = $_SESSION['custmbno'];
$otpverify = $_POST['otpnumber'];
$url = "https://api.msg91.com/api/v5/otp/verify?authkey=$authkey&mobile=$custmbno&otp=$otpverify";
$curl = curl_init($url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
//echo $response;
$json = json_decode($response);
if($json->type == 'success' ) {
header('Location: customer/index.php');
}
if($json->type == 'error' ) {
?>
<script src="source/alert/dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="source/alert/dist/sweetalert.css">
<script type="text/javascript">
function ErrorLogin (){
swal({
title: "Error",
text: " <?php $json->message ?> Invalid OTP. OTP Not Verified",
type: "error"
},
function(){
window.location.href = "<?php echo BASE_URL; ?>/sendverifyotp.php";
});
}
</script>
<script type="text/javascript" >
$( document ).ready(function() {
"use strict";
ErrorLogin();
});
</script>
<?php
}
}
}
?>
<body>
<!-- start: page -->
<section class="body-sign">
<div class="center-sign">
<a href="/" class="logo float-left">
<img src="<?php echo BASE_URL.'admin/logo/'.COMPANY_LOGO; ?>" height="34" alt="<?php echo SITE_NAME; ?>" />
</a>
<div class="panel card-sign">
<div class="card-title-sign mt-3 text-right">
<h2 class="title text-uppercase font-weight-bold m-0"><i class="fas fa-user mr-1"></i> Enter OTP</h2>
</div>
<div class="card-body">
<form class="m-t" action="" name="loginformotp" id="loginformotp" method="post" role="form">
<div class="form-group mb-3">
<label>OTP</label>
<div class="input-group">
<input type="number" class="form-control form-control-lg" placeholder="Enter OTP Number" name="otpnumber" required>
<span class="input-group-append">
<span class="input-group-text">
<i class="fas fa-user"></i>
</span>
</span>
</div>
</div>
<div class="row">
<div class="col-sm-12 text-right">
<button type="submit" name="verifyotp" class="btn btn-primary mt-2">Sign In</button>
</div>
</div>
</form>
</div>
</div>
<p class="text-center text-muted mt-3 mb-3">© Copyright 2017-<?php echo date("Y"); ?>. All Rights Reserved.</p>
</div>
</section>
<?php include('headjs.php'); ?>
</body>
</html>
<!-- Mainly scripts -->