-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooking.php
148 lines (140 loc) · 4.35 KB
/
booking.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
<?php
if (!session_id()) {
session_start();
}
include 'db.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/booking.css" />
<link rel="stylesheet" href="css/bootstrap-style.css" />
<title>Movie Seat Booking</title>
</head>
<body>
<?php include_once 'navbar.php'; ?>
<?php
echo "<script>localStorage.removeItem('occupiedSeats')</script>";
$movieId = $_POST['id'];
$date = $_POST['date'];
// $user = $_SESSION['user'];
$stmt = $conn->query("select * from booking where movieId=$movieId and date='$date';");
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($res) {
$seats = "[";
foreach ($res as $row) {
$seats = $seats . $row['seats'] . ",";
}
$seats = $seats . "]";
echo "<script>localStorage.setItem('occupiedSeats',JSON.stringify(" . $seats . "))</script>";
}
?>
<div class="body">
<div class="text-center">
<h3 id="movieName" class="title">
<?php
$res = $conn->query("select * from movielist where movieId=$movieId;");
$row = $res->fetch();
echo "" . $row['Name'];
?>
<script>
var movieDate = '<?php echo $date; ?>';
var movieId = <?php echo $row['movieId']; ?>;
if ("user" in localStorage)
var accBalance = <?php echo $userData['accBalance']; ?>;
</script>
</h3>
<div style="background-color: #fff; margin:0 auto;width:180px;color:#000;padding:5px;border-radius: 5px;">
<span id="movieDate"><?php echo $date; ?></span> <span> at <?php echo $row['showTime']; ?> </span>
</div>
<p style="margin:10px auto 20px auto;width:180px;">(Ticket Price: $20)</p>
</div>
<ul class="showcase">
<li>
<div class="seat"></div>
<small>Available</small>
</li>
<li>
<div class="seat selected"></div>
<small>Selected</small>
</li>
<li>
<div class="seat occupied"></div>
<small>Occupied</small>
</li>
</ul>
<div class="container-b">
<div class="screen"></div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
<div class="row">
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
<div class="seat"></div>
</div>
</div>
<p class="text">
You have selected <span id="count">0</span> seats for a price of $<span id="total">0</span>
</p>
<button id="booknow" style="background-color: #6feaf6; margin:10px auto; width:180px;color:#000;padding:5px;border:none;border-radius: 5px;">
Book Now
</button>
</div>
<script src="./js/booking.js"></script>
</body>
</html>