-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpayment page.php
207 lines (178 loc) · 6.3 KB
/
payment page.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!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>Payment Gateway</title>
<!-- <link rel="stylesheet" href="harry2.css"> -->
<style>
* {
margin: 0%;
padding: 0%;
}
.contuner {
border: 1px solid #6763635c;
width: 51%;
margin: 20px auto;
padding: 15px;
box-sizing: border-box;
border-radius: 10px;
}
h2 {
background-color: black;
opacity: 0.6;
height: 105px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
width: 100vw;
}
.mainhead {
color: wheat;
font-size: 35px;
width: 51%;
margin: auto;
}
input,
textarea {
width: -webkit-fill-available;
height: 28px;
}
fieldset input {
width: auto;
height: 14px;
margin-top: 7px;
padding-bottom: -122px;
}
fieldset {
padding: 5px;
height: 57px;
}
input,
textarea:focus {
outline: none;
}
textarea#address {
height: 55px;
}
</style>
</head>
<body>
<?php
session_start();
$_SESSION['no'] = $_POST["num_name"];
$a = 1;
while ($a <= $_POST["num_name"]) {
$_SESSION['pname' . $a] = $_POST['col2_' . $a];
$_SESSION['pconno' . $a] = $_POST['col3_' . $a];
$_SESSION['page' . $a] = $_POST['col4_' . $a];
// print($_POST['col2_' . $a]);
// print(" ");
// print($_POST['col3_' . $a]);
// print(" ");
// print($_POST['col4_' . $a]);
$a++;
// print("<br>");
}
$z = $_POST['num_name'];
$_SESSION["hdcunt"] = $_POST['num_name'];
$x = $_SESSION['bsnm'];
$db = mysqli_connect('localhost', 'root', '', 'online_bus') or die("Could not connect to Database");
$querry = "UPDATE bus_details SET seats_available = seats_available - $z WHERE bus_name = '$x'";
$result = mysqli_query($db, $querry) or die("Could not execute querry" . mysqli_error($db));
?>
<script>
function validate() {
var a, b, c;
a = document.getElementById("pin_id").value;
b = document.getElementById("cardNumber_id").value;
c = document.getElementById("exDate_id").value;
d = document.getElementById("cvvPass_id").value;
if (isNaN(a)) {
alert("Please enter a valid number");
return false;
}
if (isNaN(b)) {
alert("Please enter a valid number");
return false;
}
if (isNaN(d)) {
alert("Please enter a valid number");
return false;
}
var currentDate = new Date();
var day = ("0" + currentDate.getDate()).slice(-2);
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var year = currentDate.getFullYear();
var z = parseInt(year.toString() + month.toString() + day.toString());
var ne = parseInt(c.replace(/-/g, ''));
if (ne < z) {
alert("Please enter a valid card date");
return false;
}
}
</script>
<div>
<h2 class="mainhead"><b><u>Payment Form</u></b></h2>
<div class="contuner">
<h3>Contact Information</h3>
<form action="ticket page.php" autocomplete="off" method="post" onsubmit="return validate()">
<div>
Name: <input type="text" name="myName" required placeholder="type ur name">
</div>
<br>
<div>
<fieldset>
<legend>Gender</legend>
MALE<input type="radio" name="myGndr"> FEMALE <input type="radio" name="myGndr" required>
</fieldset>
</div>
<br>
<label for="address"> Address </label>
<div>
<textarea name="myText" cols="200" rows="3" id="address"></textarea>
</div>
<br>
<div>
Email: <input type="text" name="email_name" id="email_id" required placeholder="kscyubuBk@gmail.com">
</div>
<br>
<div>
Pincode: <input type="number" name="pin_name" id="pin_id" required placeholder="111111" minlength="6" maxlength="6">
</div>
<br>
<hr>
<br>
<h3>Payment Info</h3>
<br>
<div>
Card type: <select name="myCard">
<option value="">--Enter type of card--</option>
<option value="masterCard">Master Card</option>
<option value="debitCard">Debit Card</option>
</select>
</div>
<br>
<div>
Card Number: <input type="number" name="cardNumber_name" id="cardNumber_id" required placeholder="1111-2222-3333-4444" minlength="16" maxlength="16">
</div>
<br>
<div>
Expiry Date: <input type="date" name="exDate_nam" id="exDate_id" required>
</div>
<br>
<div>
CVV: <input type="password" name="cvvPass_name" id="cvvPass_id" minlength="3" maxlength="3" required placeholder="123">
</div>
<br>
<input type="submit" value="pay Now">
<br>
<br>
<input type="reset" value="Reset">
</form>
</div>
</div>
</body>
</html>