-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
178 lines (144 loc) · 6.5 KB
/
index.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
<?php
include 'dbconnect.php';
include 'server.php';
if (!isset($_SESSION['cust_id'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
else{ //Continue to current page
header( 'Content-Type: text/html; charset=utf-8' );
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['cust_name']);
header("location: login.php");
}
?>
<!DOCTYPE html>
<html lang="en" class="js csstransitions">
<head>
<title>Bus Ticket Reservation System</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/normalize.css" />
<link href="assets/css/index.css" type="text/css" rel="stylesheet" />
<!--link for javascript date&time-->
<script type="text/javascript" src="assets/js/date&time/jQuery.ptTimeSelect.js"></script>
<script type="text/javascript" src="assets/js/date&time/jquery-ui-1.8.22.custom.min.js"></script>
<script type="text/javascript" src="assets/js/date&time/jquery.ui.timepicker.js"></script>
<script type="text/javascript" src="assets/js/date&time/customDateTime.js"></script>
<!--link for stylesheet for date&time-->
<link rel="stylesheet" href="assets/css/date&time/jquery.ptTimeSelect.css" />
<link rel="stylesheet" href="assets/css/date&time/jquery.ui.timepicker.css" />
</head>
<body>
<div id="pagewrapper">
<div id="topbg"></div>
<div id="systemName">
<h1>Bus Booking</h1>
</div>
<div id="header">
<div id="mainmenu">
<header>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="timetable.php">Time Table</a></li>
<?php if (!isset($_SESSION['cust_name'])) {?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
<?php }?>
<?php if (isset($_SESSION['cust_name'])) {?>
<li> <a href="index.php?logout='1'">Logout</a> </li>
<?php }?>
</ul>
</header>
</div>
</div>
<div class="content">
<!-- notification message -->
<?php if (isset($_SESSION['success'])) {?>
<div class="error success" >
<h3 style="color: green;">
<?php
echo $_SESSION['success'];
unset($_SESSION['success']);
?>
</h3>
</div>
<?php } ?>
</div>
<div id="content">
<h1>Welcome
<?php
if (isset($_SESSION['cust_id']))
{
echo $_SESSION['cust_name'];
}
?>
</h1>
<div class="abc">
<?php include('errors.php'); ?>
<form id="search_buses_form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="has-validation-callback">
<label for="journeyFrom" class="required">Journey From</label>
<select class="select" name="journeyFrom" id="journeyFrom" style="width:150px;" data-validation="required">
<option value="">Select From</option>
<?php
$sql = "select DISTINCT departure_station from `route_detail`";
$run = mysqli_query($db,$sql);
if(!$run)
die("Unable to run query".mysqli_error());
$rows = mysqli_num_rows($run);
if($rows>0){
while($data = mysqli_fetch_object($run)){
echo '<option value="' . $data -> departure_station . '">' . $data -> departure_station . '</option>';
}
}
else{
echo "No data found <br/>";
}
?>
</select>
<br>
<label for="journeyTo" class="required">Journey To</label>
<select class="select" name="journeyTo" id="journeyTo" style="width:150px;" data-validation="required">
<option value="">Select To</option>
<?php
$sql = "select DISTINCT arrival_station from `route_detail`";
$run = mysqli_query($db,$sql);
if(!$run)
die("Unable to run query".mysqli_error());
$rows = mysqli_num_rows($run);
if($rows>0){
while($data = mysqli_fetch_object($run)){
echo '<option value="' . $data -> arrival_station . '">' . $data -> arrival_station . '</option>';
}
}
else{
echo "No data found <br/>";
}
?>
</select>
<br>
<label for="dateofJourney" class="required">Date</label>
<input style="width:147px;" name="dateOfJourney" id="dateOfJourney" type="date" class="datepicker_bus_date hasDatepicker" data-validation="required" value="<?php echo date("Y-m-d"); ?>" autocomplete="off">
<br />
<label></label>
<input style="margin:5px 25px 0;" type="submit" name="searchBuses" id="searchBuses" value="Search Buses">
</form>
</div>
</div>
<!--#contentwrapper-->
<div class="clear"></div>
<footer id="footer" class="footer">
<div class="container-fluid">
<p class="copyright pull-right">Copyright ©
<script>
document.write(new Date().getFullYear())
</script><a href="#"> OBTRS</a>.
<br> All Rights Reserved.
</p>
</div>
</footer>
</div>
</body>
</html>