-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
booking.php
149 lines (144 loc) · 5.21 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
149
<?php include('header.php');
if(!isset($_SESSION['user']))
{
header('location:login.php');
}
$qry2=mysqli_query($con,"select * from tbl_movie where movie_id='".$_SESSION['movie']."'");
$movie=mysqli_fetch_array($qry2);
?>
<div class="content">
<div class="wrap">
<div class="content-top">
<div class="section group">
<div class="about span_1_of_2">
<h3><?php echo $movie['movie_name']; ?></h3>
<div class="about-top">
<div class="grid images_3_of_2">
<img src="<?php echo $movie['image']; ?>" alt=""/>
</div>
<div class="desc span_3_of_2">
<p class="p-link" style="font-size:15px">Cast : <?php echo $movie['cast']; ?></p>
<p class="p-link" style="font-size:15px">Relece Date : <?php echo date('d-M-Y',strtotime($movie['release_date'])); ?></p>
<p style="font-size:15px"><?php echo $movie['desc']; ?></p>
<a href="<?php echo $movie['video_url']; ?>" target="_blank" class="watch_but">Watch Trailer</a>
</div>
<div class="clear"></div>
</div>
<table class="table table-hover table-bordered text-center">
<?php
$s=mysqli_query($con,"select * from tbl_shows where s_id='".$_SESSION['show']."'");
$shw=mysqli_fetch_array($s);
$t=mysqli_query($con,"select * from tbl_theatre where id='".$shw['theatre_id']."'");
$theatre=mysqli_fetch_array($t);
?>
<tr>
<td class="col-md-6">
Theatre
</td>
<td>
<?php echo $theatre['name'].", ".$theatre['place'];?>
</td>
</tr>
<tr>
<td>
Screen
</td>
<td>
<?php
$ttm=mysqli_query($con,"select * from tbl_show_time where st_id='".$shw['st_id']."'");
$ttme=mysqli_fetch_array($ttm);
$sn=mysqli_query($con,"select * from tbl_screens where screen_id='".$ttme['screen_id']."'");
$screen=mysqli_fetch_array($sn);
echo $screen['screen_name'];
?>
</td>
</tr>
<tr>
<td>
Date
</td>
<td>
<?php
if(isset($_GET['date']))
{
$date=$_GET['date'];
}
else
{
if($shw['start_date']>date('Y-m-d'))
{
$date=date('Y-m-d',strtotime($shw['start_date'] . "-1 days"));
}
else
{
$date=date('Y-m-d');
}
$_SESSION['dd']=$date;
}
?>
<div class="col-md-12 text-center" style="padding-bottom:20px">
<?php if($date>$_SESSION['dd']){?><a href="booking.php?date=<?php echo date('Y-m-d',strtotime($date . "-1 days"));?>"><button class="btn btn-default"><i class="glyphicon glyphicon-chevron-left"></i></button></a> <?php } ?><span style="cursor:default" class="btn btn-default"><?php echo date('d-M-Y',strtotime($date));?></span>
<?php if($date!=date('Y-m-d',strtotime($_SESSION['dd'] . "+4 days"))){?>
<a href="booking.php?date=<?php echo date('Y-m-d',strtotime($date . "+1 days"));?>"><button class="btn btn-default"><i class="glyphicon glyphicon-chevron-right"></i></button></a>
<?php }
$av=mysqli_query($con,"select sum(no_seats) from tbl_bookings where show_id='".$_SESSION['show']."' and ticket_date='$date'");
$avl=mysqli_fetch_array($av);
?>
</div>
</td>
</tr>
<tr>
<td>
Show Time
</td>
<td>
<?php echo date('h:i A',strtotime($ttme['start_time']))." ".$ttme['name'];?> Show
</td>
</tr>
<tr>
<td>
Number of Seats
</td>
<td>
<form action="process_booking.php" method="post">
<input type="hidden" name="screen" value="<?php echo $screen['screen_id'];?>"/>
<input type="number" required tile="Number of Seats" max="<?php echo $screen['seats']-$avl[0];?>" min="0" name="seats" class="form-control" value="1" style="text-align:center" id="seats"/>
<input type="hidden" name="amount" id="hm" value="<?php echo $screen['charge'];?>"/>
<input type="hidden" name="date" value="<?php echo $date;?>"/>
</td>
</tr>
<tr>
<td>
Amount
</td>
<td id="amount" style="font-weight:bold;font-size:18px">
Rs <?php echo $screen['charge'];?>
</td>
</tr>
<tr>
<td colspan="2"><?php if($avl[0]==$screen['seats']){?><button type="button" class="btn btn-danger" style="width:100%">House Full</button><?php } else { ?>
<button class="btn btn-info" style="width:100%">Book Now</button>
<?php } ?>
</form></td>
</tr>
<table>
<tr>
<td></td>
</tr>
</table>
</div>
<?php include('movie_sidebar.php');?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<?php include('footer.php');?>
<script type="text/javascript">
$('#seats').change(function(){
var charge=<?php echo $screen['charge'];?>;
amount=charge*$(this).val();
$('#amount').html("Rs "+amount);
$('#hm').val(amount);
});
</script>