-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
146 lines (118 loc) · 3.86 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<title>Send SMS from PHP using textlocal</title>
</head>
<style>
button{
background-color: lightgrey;
color:black;
height: 38px;
width: 123px;
font-family: "Gotham A","Gotham B",sans-serif;
font-size: 22px;
font-weight: 700;
border-radius: 10px;
border:1px solid grey;
}
button:hover{
background-color: black;
color:white;
}
.form label{
font-size: 22px;
font-weight: 700;
font-family: "Gotham A","Gotham B",sans-serif;
}
.form input{
height: 36px;
width: 504px;
font-size:16px;
background-color: lightgrey;
border-radius: 10px;
border:1px solid grey;
}
.h1{
color: black;
font-family: "Gotham A","Gotham B",sans-serif;
font-weight: 500;
line-height: 1.2;
margin: 0 0 20px;
font-size: 21px;
letter-spacing: 12px;
word-spacing: 27px;
text-align: center;
}
</style>
<body>
<!--<h1>Verify the otp to complete the payment</h1>-->
<div class="form">
<hr>
<div class="row">
<div class="col-md-9 col-md-offset-2">
<?php
if(isset($_POST['sendopt'])) {
require('textlocal.class.php');
require('credential.php');
$textlocal = new Textlocal(false, false, API_KEY);
$numbers = array($_POST['mobile']);
$sender = 'TXTLCL';
$otp = mt_rand(10000, 99999);
$message = " Hello " . $_POST['uname'] . " This is your OTP : " . $otp;
try {
$result = $textlocal->sendSms($numbers, $message, $sender);
setcookie('otp', $otp);
echo "OTP successfully sent..";
} catch (Exception $e) {
die('Error: ' . $e->getMessage());
}
}
if(isset($_POST['verifyotp'])) {
$otp = $_POST['otp'];
if($_COOKIE['otp'] == $otp) {
echo "Your payment has been successfully completed!";
} else {
echo "Please enter correct otp.";
header("Location: destinations.html");
}
}
?>
</div>
<div class="col-md-9 col-md-offset-2">
<form role="form" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-sm-9 form-group">
<label for="uname" >Name:</label><br><br>
<input type="text" class="form-control" id="uname" name="uname" value="" maxlength="10" placeholder="Enter your name" required=""><br><br>
</div>
</div>
<div class="row">
<div class="col-sm-9 form-group">
<label for="mobile">Mobile:</label><br><br>
<input type="text" class="form-control" id="mobile" name="mobile" value="" maxlength="10" placeholder="Enter valid mobile number" required=""><br><br>
</div>
</div>
<div class="row">
<div class="col-sm-9 form-group">
<button type="submit" name="sendopt" class="btn btn-lg btn-success btn-block">Send </button><br><hr>
</div>
</div>
</form>
<form method="POST" action="" onsubmit="destination.html">
<div class="row">
<div class="col-sm-9 form-group">
<label for="otp">Enter OTP:</label><br><br>
<input type="text" class="form-control" id="otp" name="otp" placeholder="Enter OTP" maxlength="5" required=""><br><br>
</div>
</div>
<div class="row">
<div class="col-sm-9 form-group">
<button type="submit" name="verifyotp" class="btn btn-lg btn-info btn-block">Verify</button>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>