-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpay.php
183 lines (169 loc) · 5.06 KB
/
pay.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
<?php
session_start();
if(isset($_SESSION['id']))
{
require("config.php");
$uid = $_SESSION['id'];
$bus = $_GET['bus'];
$seat = $_GET['seat'];
$c = $_GET['c'];
$bust = $bus.'bus';
$query = mysql_query("select fare from bus where id='$bus'");
if($query>0)
{
$r= mysql_fetch_array($query);
$fare =$r['fare'];
$tf = $fare*$seat;
/* $query = mysql_query("select * from bus where id ='$bus'");
$re1 = mysql_fetch_array($query);
$bus_name = $re1['bus_name'];
$from = $re1['from_stop'];
$to = $re1['to_stop'];
$dept_time = $re1['dept_time'];
$arrival_time = $re1['arrival_time'];
$distance = $re1['distance'];
$fare = $re1['fare'];
if($choice !='')
{
if($choice=='W' && $seat==1)
{
$query2 = "select * from $bust where status='Available' AND state='$choice' limit 0,$seat";
$p = mysql_query($query2);
$re = mysql_num_rows($p);
}
else
{
$query2 = "select * from $bust where status='Available' limit 0,$seat";
$p = mysql_query($query2);
$re = mysql_num_rows($p);
}
if($re>=$seat)
{
while($r = mysql_fetch_array($p))
{
$id = $r['id'];
$q3 = mysql_query("update $bust set status ='Booked' where id='$id'");
$q4 = mysql_query("insert into user_history(user_id, bus_id,bus_name, from_stop , to_stop, booking_date, seat_no_booked, dept_time, distance, fare) values('".$uid."','".$bus."','".$bus_name."', '".$from."', '".$to."', '".$date."', '".$id."', '".$dept_time."', '".$distance."', '".$fare."')");
}
?>
<script>
alert("Your booking request has been completed")
window.location = "Home.php?id=<?php echo $uid; ?>";
</script>
<?php
}
else
{
?>
<script>
alert("Your required seats are more then available seats");
</script>
<?php
}
}
*/
}
?><head>
<h3 style="color:#F00; text-align:center";>Welcome to Payment Gateway</h3>
<h3 style="color:#F00; text-align:center";>Enter your credit card information below. We'll add more payment opyions like M-PESA in future</h3>
<script>
function b()
{
var card = document.f.card.value; //to collect the value entered and store it in a var card
var length = card.length;//the length of the card no.
var theurl=document.f.card.value;
var numericExpression = /^[0-9]+$/; //to input the range of numerals to be input by the user
if(numericExpression.test(theurl)) //to test if the card card no is numeric
{
if(length ==16 )
{
return true;
}
else
{
alert("Card number should be of 16 Digits");
f.card.focus();
return false;
}
return true;
}
else
{
alert("Card number should be Numeric");
f.card.focus();
return false;
}
}
function isNumeric()
{
var theurl=document.f.acc.value;
var numericExpression = /^[0-9]+$/;
if(numericExpression.test(theurl) && theurl !='')
{
return true;
}
else
{
alert("Enter no only");
document.getElementById('acc').focus();
return false;
}
}
function d()
{
var crdn = document.f.crdname.value;
if(crdn =='')
{
alert("Card holder's Name can not be blank,please fill it");
ddocument.getElementyId('crdname').focus();
return false;
}
else
{
return true;
}
}
function e()
{
var con = confirm("Are you sure,you want to Continue");
if(con ==true)
{
<?php
//header("Location:booked.php?id=$uid&bus=$bus&seat=$seat");
?>
window.location ="booked.php?id=<?php echo $uid;?>&bus=<?php echo $bus?>&seat=<?php echo $seat;?>&c=<?php echo $c;?>";
}
else
{
}
}
function g()
{
window.location ="Home.php?id=<?php echo $uid; ?>";
}
</script>
</head>
<br>
<br>
<form name="f" method="post">
<div style="padding-left:18%">
<pre>Account Number :<input type="text" name="acc" id="acc" value="" onBlur="isNumeric()"><br>
Card Number :<input type="text" name="card" value="" onBlur="b()">
<br>
Card Holder's Name :<input type="text" name="crdname" id="crdname" value="" onBlur="d()">
</pre><br>
<span style="background-color:#000fff"><?php echo "Amount to be deducted from your account is KSHS ".$tf; ?></span><br>
<br>
<input type="button" name="ok" value="Confirm" onClick="e()">
<input type="button" name="can" value="Cancel" onClick="g()">
</div>
</form><?php
}
else
{
header("Location:index.php");
}
?>