-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayment.php
More file actions
126 lines (126 loc) · 5.35 KB
/
payment.php
File metadata and controls
126 lines (126 loc) · 5.35 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
<html>
<head>
<title>Booking Seats</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-image : url('payment.jpeg');
background-repeat : no-repeat;
background-attachment : fixed;
background-size : 100vw 100vh;
color : white;
text-align : center;
}
.form {
display : flex;
justify-content : center;
padding : 10px;
margin-top : 10vh;
}
form {
color : black;
background-color : rgba(255,255,255,0.5);
border-radius : 10px;
padding : 10px;
}
fieldset {
border : none;
}
input {
text-align : center;
}
input[type="radio"] {
display : none;
}
input[type="submit"] {
color : white;
background-color : rgb(64,64,64);
border : none;
border-radius : 5px;
padding : 10px;
}
.selected {
padding : 5px;
border-bottom : 2px solid ;
background-color : rgba(64,64,64,0.3)
}
</style>
<?php
$cn = "";
$dt = "";
$cv = "";
$n = "";
$p = 0;
if($_SERVER["REQUEST_METHOD"]=="POST") {
$cn = $_POST["cardno"];
$dt = $_POST["date"];
$cv = $_POST["cvv"];
$n = $_POST["name"];
$p = 1;
} else {
echo "<p style='font-size:1.5em'>You are going to book ".$_GET["num"]." seats</p>";
}
?>
</head>
<body>
<h1>Payment</h1>
<div class="form">
<form action="?" method="POST">
<fieldset id="form">
<fieldset id="selection">
<label id="1" for="self" class="<?php if(!$n) {echo "selected";}?>" style="margin-right:10px;" onclick="selection(1)">Self</label>
<input type="radio" id="self" name="decision" checked>
<label id="2" for="others" style="margin-left:10px;" onclick="selection(2)">Others</label>
<input type="radio" id="others" name="decision">
</fieldset>
<label for="name">Name :                 </label>
<input type="text" id="name" name="name" value="<?php if(!$n) {echo "Sahiti";} else {echo $n;}?>" readonly required><br><br>
<label for="cardno">Enter Card No. :  </label>
<input type="text" id="cardno" name="cardno" maxlength="16" onkeypress="return onlyNumberKey(event)" value="<?php echo $cn;?>" required><br><br>
<label for="date">Enter the Expiry date:</label>
<input type="date" id="date" name="date" value="<?php echo $dt;?>" required><br><br>
<label for="cvv">Enter CVV No. :                             </label>
<input type="text" style="width:3em;" id="cvv" name="cvv" maxlength="3" onkeypress="return onlyNumberKey(event)" value="<?php echo $cv;?>" required><br><br>
<input type="submit" value="Get OTP">
</fieldset>
</form>
</div>
<div class="form" id="otpform">
<form action="ticket.php" method="POST">
<input type="hidden" id="hidden" name="hidden" value="<?php if(!$n) {echo "Sahiti";} else {echo $n;} ?>">
<label for="OTP">Enter the OTP here : </label>
<input type="text" id="OTP" name="OTP" maxlength="6" onkeypress="return onlyNumberKey(event)" required><br><br>
<input type="submit" value="Pay">
</form>
</div>
<script>
function onlyNumberKey(evt) {
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57))
return false;
return true;
}
function selection(x){
if(x==1) {
document.getElementById("1").classList.add("selected");
document.getElementById("2").classList.remove("selected");
document.getElementById("name").value = "Sahiti";
document.getElementById("name").disabled=true;
} else {
document.getElementById("1").classList.remove("selected");
document.getElementById("2").classList.add("selected");
document.getElementById("name").disabled=false;
document.getElementById("name").value = "";
}
}
if(<?php echo $p; ?>) {
document.getElementById("form").disabled=true;
document.getElementById("otpform").style.display="flex";
document.getElementById("selection").style.display="none";
} else {
document.getElementById("form").disabled=false;
document.getElementById("otpform").style.display="none";
}
</script>
</body>
</html>