0% found this document useful (0 votes)
198 views131 pages

Bus Ticket System Full Report

Uploaded by

Taukir pasha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views131 pages

Bus Ticket System Full Report

Uploaded by

Taukir pasha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 131

DECLARATION

To,
The Principal,
Zulekha College of Commerce, Science & Technology,
Nagpur

Respected Sir,

We, are undersigned hereby declare that, the work entitled, “Bus Booking System”
Develop in “Html, Css as Frontend”, “Php as Backend” & “MySQL as
Database” submitted by us is our original work. The system presented here in is
Developed by us independently and has not been duplicated from any other source.

We undersigned that any such copying in liable to be punished in anyway by the board
Authority deem fit.

Thanking You,

Yours sincerely

Miss. Sidra Naaz

Mr. Riyaz Ansari


ACKNOWLEDGEMENT

We, feel it to very proud privilege to express my most sincere and heartiest sense of
Gratitude towards Prof.Hazra Siddhiqui, Zulekha College of Commerce, Science &
Technology Nagpur, on whose inspiration this piece of work was undertaken. It was his
constant invaluable guidance and ever willing help, and constant encouragement, which
make this study possible.

We are also thankful to our Principal Dr. Nandkishor Zade sir of our college for
providing us the required facilities to develop this project.

We are also thankful to our HOD Prof. Rita Bhaisare for helping us for the development
of our project.

At last, thanks to our parents and those persons who are directly or indirectly involved
In completion of this work.

Miss. Sidra Naaz

Mr. Riyaz Ansari


Index

Sr.No CONTEXT PAGE.NO


1 Introduction of Project 1

2 Objective of System 2

3 Preliminary system Analysis 3-5


a) Identification of need
b) Feasibility study
c)Flaws in the present system

4 Language Use in Project 6

5 Software Requirement Specification 7

6 Hardware specification 8

7 Detailed System Analysis 9-12


a) Data Flow Diagram
b) System Flow diagram
c) Data Dictionary

8 System Design 13-


a) Input/output screen
b) Source Code
9 Limitation of project 9

10 Future scope of project

11 Conclusion

Bibliography
Page 1

1. Introduction of Project
Bus Ticket Booking System

Bus ticket booking system project in PHP and MYSQL focuses mainly on online ticket
reservations and route management. Also, the system displays all the lists of available
routes according to their prices. In addition, the system allows managing bus
information too. This project is divided into two categories: Admin, and Customer. In an
overview of this web application, the role of the customer is pretty simple. A customer
can only check the ticket’s status using PNR. Here, the admin has to provide the PNR
code. As result, the customers can have their bus ticket details such as route, seat,
timing, and other information. Besides, all other features fall upon the hands of an
administrator.
Page 2

2.Objective of the System:

The Bus ticket reservation system is currently maintaining the project Transport
Company’s process manually which is a very time consuming process. It deals with
transport industry’s ticket booking and transport maintenance, so it becomes a very
tedious job for the ticket booking transporter to look after these particulars to complete
the task at right time. The bus ticket booking system not only deals with transporters
owned vehicles but also takes into consideration about the other types project of system
transport vehicles available with other transporters.

To develop a software application that supports Specific to the project Travel Agency
Automation that can solve all tedious tasks related to ticket booking in a travel agency.

This system will lead to increase in the ticket booking efficiency of the project Staff and
members of the Ticket Booking Agency with little throughput.

This system project is made as user friendly as possible so that anyone can use it with
little knowledge of system computers.

The ticket booking project will reduce the ticket booking tedious job of system paperwork
by keeping all the project details of bus ticket booking, cancelling tickets are stored in the
form database in computer’s hard disk.

Up-to-date information of the system Performance status and other enquires.

We provide up to date information that is not possible manually.

The objective of my project is to make easy the ticket booking project system of Ticket
Booking Agency simple, reliable, user friendly, and corrective. Moreover, less time
consuming as compared to manual work.

Report of the ticket booking different aspects can be generated like Available sits, current
status of booking Cancelling details monthly status report etc.
Page 3

3. Preliminary system analysis

a) Identification of need: -

The system is very simple in design and to implement. The system requires very low
system resources and the system will work in almost all configurations. It has got
following features:

• It will ensure data accuracy.

• Records will be efficiently maintained by DBMS. • Availability of seats can be enquired


easily. • Passengers can also cancel their tickets easily.

• Minimum time needed for the various processing.

• It will provide better Service.

b) Feasibility Study: -

The feasibility study was intended to examine the current system and determine
whether there was need for a new system to replace it or not. It tended to check
whether the current system was viable. Basically, this was meant to analyze the
feasibility of a new system through cost-benefit analysis. It included: Legal
feasibility, operational feasibility, economic feasibility, technical feasibility and
schedule feasibility.

i) Social operational feasibility: -

This is a measure of how well a proposed system solves the problems, and takes
advantage of the opportunities identified during scope definition and how it
satisfies the requirements identified in the requirements analysis phase of system
development. It dealt with the effect of the system on the current society within
the company. The operational feasibility assessment focused on the degree to
which the proposed development projects fitted in with the existing business
environment and objectives with regard to development schedule, delivery date,
corporate culture, and existing business processes.
Page 4

ii) Legal feasibility: -


This study was conducted to determine whether the proposed system conflicted
with legal requirements. These were data processing system must comply with
the Local Data Protection Acts. Any legal aspects associated with the new system
were assessed and then adequate measures taken to protect the interest of clients
at Modern coast bus ticket booking system. The Modern coast bus ticket booking
system Solutions went through this stage successfully and the system was found
feasible.

iii) Economic feasibility: -


The purpose of the economic feasibility assessment was to determine the
positive economic benefits to the organization that the proposed system
had to provide. It included quantification and identification of all the
benefits expected. This assessment typically involved a Cost-Benefits
Analysis (CBA).

iv) Technical feasibility: -

The assessment focused on gaining an understanding of the present


technical resources of ticket booking sector and their applicability in the
proposed system. This was aimed at evaluating both hardware and
software required for the new system. It also determined whether the
current facilities were adequate for the new system implementation.

v) Schedule feasibility: -
Schedule feasibility is a measure of how reasonable the project timetable
is. However, this means estimating how long the system would take to
develop, and if it can be completed in a given time period using some
methods like payback period. According to the time schedule of this
system, it was clear that the project would be scheduled feasible since it
Page 5

would take approximately 3 months which was a relatively short period for
such a system.

c) Flaws in Current System: -


• Remove sources of customer friction.
• Implement a user-friendly booking engine.
• Enable social media booking.
• Create a smart and intuitive booking process.
• Save offers and extras for after confirmation.
• Display clear calls-to-action.
• Optimise website functionality.
Page 6

4.Language Used in System

Frontend: -
1.HTML: HTML, in full hypertext markup language, a formatting system for displaying
material retrieved over the Internet. Each retrieval unit is known as a Web page (from
World Wide Web), and such pages frequently contain hypertext links that allow related
pages to be retrieved. HTML is the markup language for encoding Web pages. It was
designed by the British Scientist Sir Tim Berners-Lee at the CERN nuclear physics
laboratory in Switzerland during the 1980s. HTML markup tags specify document
elements such as headings, paragraphs, and tables. They mark up a document for
display by a computer program known as a Web browser.
2. CSS: CSS stands for Cascading Style Sheets
CSS describes how HTML elements are to be displayed on screen, paper, or in other
media
CSS saves a lot of work. It can control the layout of multiple web pages all at once
External stylesheets are stored in CSS files.

Backend: -
PHP: PHP is a general-purpose scripting language especially suited to web
development. It was originally created by Danish-Canadian programmer Rasmus
Lerdorf in 1994.The PHP reference implementation is now produced by The PHP
Group. PHP originally stood for Personal Home Page, but it now stands for the recursive
initialize PHP: Hypertext Preprocessor.

Database: -
MySQL: MySQL is an open-source relational database management system
(RDBMS). Its name is a combination of "My", the name of co-founder Michael
Widenius's daughter, and "SQL", the abbreviation for Structured Query
Language.
Page 7

5. Software Requirement Specification

Then we began with the design phase of the system. System design is a solution, a “HOW
TO” approach to the creation of a new system. It translates system requirements into ways
by which they can be made operational. It is a translational from a user oriented
document to a document oriented programmers. For that, it provides the understanding
and procedural details necessary for the implementation. Here we use Flowchart to
supplement the working of the new system. The system thus made should be reliable,
durable and above all should have least possible maintenance costs. It should overcome
all the drawbacks of the Old existing system and most important of all meet the user
requirements.

Software requirement

1.Operating System: - Needs Microsoft Windows 7 or higher Operating System

2.Front end: - Html, Css and bootstrap

3.Back end: - Php

4.Database: - MySQL

5.Server: - XAMPP is one of the widely used cross-platform web servers, which helps
developers to create and test their programs on a local webserver.
Page 8

6. Hardware Requirements Specification: -

Hardware Requirements

1.Processor: - Intel® Pentium®

2. RAM: - 512 MB

3.Harddisk: -20 GB

4.System Type: X-86 Based Pc or X-64 Based Pc.


Page 9

7. Detailed System Analysis: -

Data Flow diagram: -


Page 10

i) For Administrator login: -

Admin
Login details database

Admin log Admin Admin log


in update out
bookings &

Post &
change bus
company

ii) For Client Login: -

Registrations details

User User log in


registratio
User check
progress
User and
booking

Booking Details

User log
out
Page 11

b) System Flow diagram: -


Page 12

C)Data Dictionary: -
Page 13

8. System Design: -

1.Home Page: -

Source code: -
<?php
require 'assets/partials/_functions.php';
$conn = db_connect();

if(!$conn)
die("Connection Failed");
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
Page 14

<meta http-equiv="X-UA-Compatible" content="IE=edge">


<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bus Ticket Bookings</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Font-awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- CSS -->
<?php
require 'assets/styles/styles.php'
?>
</head>
<body>
<?php

if(isset($_GET["booking_added"]) && !isset($_POST['pnr-search']))


{
if($_GET["booking_added"])
{
Page 15

echo '<div class="my-0 alert alert-success alert-dismissible fade show"


role="alert">
<strong>Successful!</strong> Booking Added, your PNR is <span style="font-
weight:bold; color: #272640;">'. $_GET["pnr"] .'</span>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else{
// Show error alert
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Booking already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}

if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["pnr-search"]))


{
$pnr = $_POST["pnr"];

$sql = "SELECT * FROM bookings WHERE booking_id='$pnr'";


$result = mysqli_query($conn, $sql);

$num = mysqli_num_rows($result);
Page 16

if($num)
{
$row = mysqli_fetch_assoc($result);
$route_id = $row["route_id"];
$customer_id = $row["customer_id"];

$customer_name = get_from_table($conn, "customers", "customer_id",


$customer_id, "customer_name");

$customer_phone = get_from_table($conn, "customers", "customer_id",


$customer_id, "customer_phone");

$customer_route = $row["customer_route"];
$booked_amount = $row["booked_amount"];

$booked_seat = $row["booked_seat"];
$booked_timing = $row["booking_created"];

$dep_date = get_from_table($conn, "routes", "route_id", $route_id,


"route_dep_date");

$dep_time = get_from_table($conn, "routes", "route_id", $route_id,


"route_dep_time");

$bus_no = get_from_table($conn, "routes", "route_id", $route_id, "bus_no");


?>

<div class="alert alert-dark alert-dismissible fade show" role="alert">


Page 17

<h4 class="alert-heading">Booking Information!</h4>


<p>
<button class="btn btn-sm btn-success"><a
href="assets/partials/_download.php?pnr=<?php echo $pnr; ?>" class="link-
light">Download</a></button>
<button class="btn btn-danger btn-sm" id="deleteBooking" data-bs-
toggle="modal" data-bs-target="#deleteModal" data-pnr="<?php echo $pnr;?>" data-
seat="<?php echo $booked_seat;?>" data-bus="<?php echo $bus_no; ?>">
Delete
</button>
</p>
<hr>
<p class="mb-0">
<ul class="pnr-details">
<li>
<strong>PNR : </strong>
<?php echo $pnr; ?>
</li>
<li>
<strong>Customer Name : </strong>
<?php echo $customer_name; ?>
</li>
<li>
<strong>Customer Phone : </strong>
<?php echo $customer_phone; ?>
</li>
<li>
Page 18

<strong>Route : </strong>
<?php echo $customer_route; ?>
</li>
<li>
<strong>Bus Number : </strong>
<?php echo $bus_no; ?>
</li>
<li>
<strong>Booked Seat Number : </strong>
<?php echo $booked_seat; ?>
</li>
<li>
<strong>Departure Date : </strong>
<?php echo $dep_date; ?>
</li>
<li>
<strong>Departure Time : </strong>
<?php echo $dep_time; ?>
</li>
<li>
<strong>Booked Timing : </strong>
<?php echo $booked_timing; ?>
</li>

</p>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
Page 19

</div>
<?php }
else{
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Record Doesnt Exist
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}

?>

<?php }

// Delete Booking
if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["deleteBtn"]))
{
$pnr = $_POST["id"];
$bus_no = $_POST["bus"];
$booked_seat = $_POST["booked_seat"];

$deleteSql = "DELETE FROM `bookings` WHERE `bookings`.`booking_id` =


'$pnr'";

$deleteResult = mysqli_query($conn, $deleteSql);


Page 20

$rowsAffected = mysqli_affected_rows($conn);
$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "Record Doesn't Exist";
}

elseif($deleteResult)
{
$messageStatus = "success";
$messageInfo = "Booking Details deleted";
$messageHeading = "Successfull!";

// Update the Seats table


$seats = get_from_table($conn, "seats", "bus_no", $bus_no,
"seat_booked");

// Extract the seat no. that needs to be deleted


$booked_seat = $_POST["booked_seat"];

$seats = explode(",", $seats);


$idx = array_search($booked_seat, $seats);
array_splice($seats,$idx,1);
$seats = implode(",", $seats);
Page 21

$updateSeatSql = "UPDATE `seats` SET `seat_booked` = '$seats' WHERE


`seats`.`bus_no` = '$bus_no';";
mysqli_query($conn, $updateSeatSql);
}
else{

$messageInfo = "Your request could not be processed due to technical


Issues from our part. We regret the inconvenience caused";
}

// Message
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
?>

<header>
<nav>
<div>
<a href="#" class="nav-item nav-logo">ATP</a>
<!-- <a href="#" class="nav-item">Gallery</a> -->
</div>
Page 22

<ul>
<li><a href="#" class="nav-item">Home</a></li>
<li><a href="#about" class="nav-item">About</a></li>
<li><a href="#contact" class="nav-item">Contact</a></li>
</ul>
<div>
<a href="#" class="login nav-item" data-bs-toggle="modal" data-bs-
target="#loginModal"><i class="fas fa-sign-in-alt" style="margin-right:
0.4rem;"></i>Login</a>
<a href="#pnr-enquiry" class="pnr nav-item">PNR Enquiry</a>
</div>
</nav>
</header>
<!-- Login Modal -->
<?php require 'assets/partials/_loginModal.php';
require 'assets/partials/_getJSON.php';

$routeData = json_decode($routeJson);
$busData = json_decode($busJson);
$customerData = json_decode($customerJson);
?>

<section id="home">
<div id="route-search-form">
<h1>Simple Bus Ticket Booking System</h1>
Page 23

<p class="text-center">Welcome to Simple Bus Ticket Booking System. Login


now to manage bus tickets and much more. OR, simply scroll down to check the Ticket
status using Passenger Name Record (PNR number)</p>

<center>
<button class="btn btn-danger " data-bs-toggle="modal" data-bs-
target="#loginModal">Administrator Login</button>

</center>

<br>
<center>
<a href="#pnr-enquiry"><button class="btn btn-primary">Scroll Down <i
class="fa fa-arrow-down"></i></button></a>
</center>

</div>
</section>
<div id="block">
<section id="info-num">
<figure>
<img src="assets/img/route.svg" alt="Bus Route Icon" width="100px"
height="100px">
<figcaption>
<span class="num counter" data-target="<?php echo count($routeData);
?>">999</span>
<span class="icon-name">routes</span>
</figcaption>
</figure>
Page 24

<figure>
<img src="assets/img/bus.svg" alt="Bus Icon" width="100px" height="100px">
<figcaption>
<span class="num counter" data-target="<?php echo count($busData);
?>">999</span>
<span class="icon-name">bus</span>
</figcaption>
</figure>
<figure>
<img src="assets/img/customer.svg" alt="Happy Customer Icon"
width="100px" height="100px">
<figcaption>
<span class="num counter" data-target="<?php echo
count($customerData); ?>">999</span>
<span class="icon-name">happy customers</span>
</figcaption>
</figure>
<figure>
<img src="assets/img/ticket.svg" alt="Instant Ticket Icon" width="100px"
height="100px">
<figcaption>
<span class="num"><span class="counter" data-target="20">999</span>
SEC</span>
<span class="icon-name">Instant Tickets</span>
</figcaption>
</figure>
</section>
<section id="pnr-enquiry">
Page 25

<div id="pnr-form">
<h2>PNR ENQUIRY</h2>
<form action="<?php echo $_SERVER["REQUEST_URI"]; ?>"
method="POST">
<div>
<input type="text" name="pnr" id="pnr" placeholder="Enter PNR">
</div>
<button type="submit" name="pnr-search">Submit</button>
</form>
</div>
</section>
<section id="about">
<div>
<h1>About Us</h1>
<h4>Wanna know were it all started?</h4>
<p>
Moving on, this bus ticket booking system project in PHP focuses mainly on
online ticket reservations and route management. Also, the system displays all the lists
of available routes according to their prices. In addition, the system allows managing
bus information too. This project is divided into two categories: Admin, and Customer. In
an overview of this web application, the role of the customer is pretty simple. A
customer can only check the ticket’s status using PNR. Here, the admin has to provide
the PNR code. As result, the customers can have their bus ticket details such as route,
seat, timing, and other information. Besides, all other features fall upon the hands of an
administrator.
</p>
</div>
</section>
<section id="contact">
Page 26

<div id="contact-form">
<h1>Contact Us</h1>
<form action="">
<div>
<label for="name">Name</label>
<input type="text" name="name" id="name">
</div>
<div>
<label for="email">Email Address</label>
<input type="email" name="email" id="email">
</div>
<div>
<label for="message">Message</label>
<textarea name="message" id="message" cols="30"
rows="10"></textarea>
</div>
<div></div>
</form>
</div>
</section>
<footer>
<p>
<i class="far fa-copyright"></i> <?php echo date('Y');?> - Simple Bus
Ticket Booking System | Made with &#10084;&#65039; by Sidra & Riyaz
</p>
</footer>
</div>
Page 27

<!-- Delete Booking Modal -->


<div class="modal fade" id="deleteModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fas fa-exclamation-
circle"></i></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<h2 class="text-center pb-4">
Are you sure?
</h2>
<p>
Do you really want to delete your booking? <strong>This process cannot be
undone.</strong>
</p>
<!-- Needed to pass pnr -->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" id="delete-form"
method="POST">
<input id="delete-id" type="hidden" name="id">
<input id="delete-booked-seat" type="hidden" name="booked_seat">
<input id="delete-booked-bus" type="hidden" name="bus">
</form>
</div>
<div class="modal-footer">
Page 28

<button type="submit" form="delete-form" class="btn btn-primary btn-danger"


name="deleteBtn">Delete</button>
</div>
</div>
</div>
</div>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
<!-- External JS -->
<script src="assets/scripts/main.js"></script>
</body>
</html>
Page 29

2.Dashboard –

Source Code: -
<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 30

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/dashboard.php';
$page="dashboard";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';
require '../assets/partials/_getJSON.php';
// Will have access to variables
// 1. routeJson
// 2. customerJson
// 3. seatJson
// 4. busJson
// 5. adminJson
// 6. bookingJSON
Page 31

$routeData = json_decode($routeJson);
$customerData = json_decode($customerJson);
$seatData = json_decode($seatJson);
$busData = json_decode($busJson);
$adminData = json_decode($adminJson);
$bookingData = json_decode($bookingJson);
// $earningData = json_decode($earningJson);

// echo "<pre>";
// var_export(get_object_vars($adminData[0])["user_fullname"]);
// var_export($adminData);
// var_export($_SESSION);
// echo "</pre>";

?>

<section id="dashboard">

<div id="status">
<div id="Booking" class="info-box status-item">
<div class="heading">
<h5>Bookings</h5>
<div class="info">
<i class="fas fa-ticket-alt"></i>
</div>
</div>
Page 31

<div class="info-content">
<p>Total Bookings</p>
<p class="num" data-target="<?php
echo count($bookingData);
?>">
999
</p>
</div>
<a href="./booking.php">View More <i class="fas fa-arrow-
right"></i></a>
</div>
<div id="Bus" class="info-box status-item">
<div class="heading">
<h5>Buses</h5>
<div class="info">
<i class="fas fa-bus"></i>
</div>
</div>
<div class="info-content">
<p>Total Buses</p>
<p class="num" data-target="<?php
echo count($busData);
?>">
999
</p>
</div>
<a href="./bus.php">View More <i class="fas fa-arrow-right"></i></a>
Page 32

</div>
<div id="Route" class="info-box status-item">
<div class="heading">
<h5>Routes</h5>
<div class="info">
<i class="fas fa-road"></i>
</div>
</div>
<div class="info-content">
<p>Total Routes</p>
<p class="num" data-target="<?php
echo count($routeData);
?>">
999
</p>
</div>
<a href="./route.php">View More <i class="fas fa-arrow-right"></i></a>
</div>
<div id="Seat" class="info-box status-item">
<div class="heading">
<h5>Seats</h5>
<div class="info">
<i class="fas fa-th"></i>
</div>
</div>
<div class="info-content">
Page 33

<p>Total Seats</p>
<p class="num" data-target="<?php
echo 38 * count($busData);
?>">
999
</p>
</div>
<a href="./seat.php">View More <i class="fas fa-arrow-right"></i></a>
</div>
</div>
<!-- <h3>User</h3> -->
<div id="user">
<div id="Customer" class="info-box user-item">
<div class="heading">
<h5>Customers</h5>
<div class="info">
<i class="fas fa-users"></i>
</div>
</div>
<div class="info-content">
<p>Total Customers</p>
<p class="num" data-target="<?php
echo count($customerData);
?>">
999
</p>
Page 34

</div>
<a href="./customer.php">View More <i class="fas fa-arrow-
right"></i></a>
</div>
<div id="Admin" class="info-box user-item">
<div class="heading">
<h5>Admins</h5>
<div class="info">
<i class="fas fa-user-lock"></i>
</div>
</div>
<div class="info-content">
<p>Total Admins</p>
<p class="num" data-target="<?php
echo count($adminData);
?>">
999
</p>
</div>
<a href="#admin">View More <i class="fas fa-arrow-right"></i></a>
</div>

<div id="Earning" class="info-box user-item">


<div class="heading">
<h5>Earnings</h5>
<div class="info">
<i class="fas fa-dollar-sign"></i>
Page 35

</div>
</div>
<div class="info-content">
<p>Total Earnings</p>
<p class="num" data-target="<?php
$result = mysqli_query($conn, 'SELECT SUM(booked_amount)
AS value_sum FROM bookings');
$row = mysqli_fetch_assoc($result);
$sum = $row['value_sum'];
echo $sum;
?>">
999
</p>
</div>
<a href="#">View More <i class="fas fa-arrow-right"></i></a>
</div>

</div>
<h4>Other Admin</h4>
<div id="admin">
<?php
// Loop through Admin Data and show the admins in boxes other than
the existing admin which is $user_id == $_SESSION["user_id"]
foreach($adminData as $admin)
{
$adminArr = get_object_vars($admin);
if($adminArr["user_id"] == $user_id)
Page 36

continue;
$username = $adminArr["user_name"];
?>
<div class="info-box admin-item">
<img src="../assets/img/user-profile-min.png" height="100px"
alt="Profile Pic">
<h4><?php echo $username; ?></h4>
<p class="bio">Other Admin</p>
</div>
<?php
}
?>
</div>
</section>
<footer>
<p>
<i class="far fa-copyright"></i> <?php echo date('Y');?> - Simple Bus
Ticket Booking System | Made with &#10084;&#65039; by Sidra & Riyaz
</p>
</footer>
</div>
</main>
<script src="../assets/scripts/admin_dashboard.js"></script>
</body>
</html>
Page 37

3.Booking: -

Source Code: -
<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bookings</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 38

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- External CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/admin-options.php';
$page="booking";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';?>
<!-- Add, Edit and Delete Bookings -->
<?php
/*
1. Check if an admin is logged in
2. Check if the request method is POST
*/
if($loggedIn && $_SERVER["REQUEST_METHOD"] == "POST")
Page 39

{
if(isset($_POST["submit"]))
{
/*
ADDING Bookings
Check if the $_POST key 'submit' exists
*/
// Should be validated client-side
// echo "<pre>";
// var_export($_POST);
// echo "</pre>";
// die;
$customer_id = $_POST["cid"];
$customer_name = $_POST["cname"];
$customer_phone = $_POST["cphone"];
$route_id = $_POST["route_id"];
$route_source = $_POST["sourceSearch"];
$route_destination = $_POST["destinationSearch"];
$route = $route_source . " &rarr; " . $route_destination;
$booked_seat = $_POST["seatInput"];
$amount = $_POST["bookAmount"];
// $dep_timing = $_POST["dep_timing"];

$booking_exists = exist_booking($conn,$customer_id,$route_id);
$booking_added = false;
Page 40

if(!$booking_exists)
{
// Route is unique, proceed
$sql = "INSERT INTO `bookings` (`customer_id`, `route_id`,
`customer_route`, `booked_amount`, `booked_seat`, `booking_created`) VALUES
('$customer_id', '$route_id','$route', '$amount', '$booked_seat', current_timestamp());";

$result = mysqli_query($conn, $sql);


// Gives back the Auto Increment id
$autoInc_id = mysqli_insert_id($conn);
// If the id exists then,
if($autoInc_id)
{
$key = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$code = "";
for($i = 0; $i < 5; ++$i)
$code .= $key[rand(0,strlen($key) - 1)];

// Generates the unique bookingid


$booking_id = $code.$autoInc_id;

$query = "UPDATE `bookings` SET `booking_id` = '$booking_id'


WHERE `bookings`.`id` = $autoInc_id;";
$queryResult = mysqli_query($conn, $query);

if(!$queryResult)
echo "Not Working";
Page 41

if($result)
$booking_added = true;
}

if($booking_added)
{
// Show success alert
echo '<div class="my-0 alert alert-success alert-dismissible fade show"
role="alert">
<strong>Successful!</strong> Booking Added
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';

// Update the Seats table


$bus_no = get_from_table($conn, "routes", "route_id", $route_id,
"bus_no");
$seats = get_from_table($conn, "seats", "bus_no", $bus_no,
"seat_booked");
if($seats)
{
$seats .= "," . $booked_seat;
}
else
$seats = $booked_seat;
Page 42

$updateSeatSql = "UPDATE `seats` SET `seat_booked` = '$seats' WHERE


`seats`.`bus_no` = '$bus_no';";
mysqli_query($conn, $updateSeatSql);
}
else{
// Show error alert
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Booking already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
if(isset($_POST["edit"]))
{
// EDIT BOOKING
// echo "<pre>";
// var_export($_POST);
// echo "</pre>";die;
$cname = $_POST["cname"];
$cphone = $_POST["cphone"];
$id = $_POST["id"];
$customer_id = $_POST["customer_id"];
$id_if_customer_exists = exist_customers($conn,$cname,$cphone);

if(!$id_if_customer_exists || $customer_id == $id_if_customer_exists)


Page 43

{
$updateSql = "UPDATE `customers` SET
`customer_name` = '$cname',
`customer_phone` = '$cphone' WHERE `customers`.`customer_id` =
'$customer_id';";

$updateResult = mysqli_query($conn, $updateSql);


$rowsAffected = mysqli_affected_rows($conn);

$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "No Edits Administered!";
}

elseif($updateResult)
{
// Show success alert
$messageStatus = "success";
$messageHeading = "Successfull!";
$messageInfo = "Customer details Edited";
}
else{
// Show error alert
Page 44

$messageInfo = "Your request could not be processed due to technical Issues from our
part. We regret the inconvenience caused";
}

// MESSAGE
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else{
// If customer details already exists
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Customer already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}

}
if(isset($_POST["delete"]))
{
// DELETE BOOKING
$id = $_POST["id"];
$route_id = $_POST["route_id"];
Page 45

// Delete the booking with id => id


$deleteSql = "DELETE FROM `bookings` WHERE `bookings`.`id` = $id";

$deleteResult = mysqli_query($conn, $deleteSql);


$rowsAffected = mysqli_affected_rows($conn);
$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "Record Doesn't Exist";
}

elseif($deleteResult)
{
$messageStatus = "success";
$messageInfo = "Booking Details deleted";
$messageHeading = "Successfull!";

// Update the Seats table


$bus_no = get_from_table($conn, "routes", "route_id", $route_id,
"bus_no");
$seats = get_from_table($conn, "seats", "bus_no", $bus_no,
"seat_booked");

// Extract the seat no. that needs to be deleted


Page 46

$booked_seat = $_POST["booked_seat"];

$seats = explode(",", $seats);


$idx = array_search($booked_seat, $seats);
array_splice($seats,$idx,1);
$seats = implode(",", $seats);

$updateSeatSql = "UPDATE `seats` SET `seat_booked` = '$seats' WHERE


`seats`.`bus_no` = '$bus_no';";
mysqli_query($conn, $updateSeatSql);
}
else{

$messageInfo = "Your request could not be processed due to technical


Issues from our part. We regret the inconvenience caused";
}

// Message
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
?>
<?php
Page 47

$resultSql = "SELECT * FROM `bookings` ORDER BY booking_created DESC";

$resultSqlResult = mysqli_query($conn, $resultSql);

if(!mysqli_num_rows($resultSqlResult)){ ?>
<!-- Bookings are not present -->
<div class="container mt-4">
<div id="noCustomers" class="alert alert-dark " role="alert">
<h1 class="alert-heading">No Bookings Found!!</h1>
<p class="fw-light">Be the first person to add one!</p>
<hr>
<div id="addCustomerAlert" class="alert alert-success" role="alert">
Click on <button id="add-button" class="button btn-
sm"type="button"data-bs-toggle="modal" data-bs-target="#addModal">ADD <i
class="fas fa-plus"></i></button> to add a booking!
</div>
</div>
</div>
<?php }
else { ?>
<section id="booking">
<div id="head">
<h4>Booking Status</h4>
</div>
<div id="booking-results">
<div>
Page 48

<button id="add-button" class="button btn-sm"type="button"data-bs-toggle="modal"


data-bs-target="#addModal">Add Bookings<i class="fas fa-plus"></i></button>
</div>
<table class="table table-hover table-bordered">
<thead>
<th>PNR</th>
<th>Name</th>
<th>Contact</th>
<th>Bus</th>
<th>Route</th>
<th>Seat</th>
<th>Amount</th>
<th>Departure</th>
<th>Booked</th>
<th>Actions</th>
</thead>
<?php
while($row = mysqli_fetch_assoc($resultSqlResult))
{
// echo "<pre>";
// var_export($row);
// echo "</pre>";
$id = $row["id"];
$customer_id = $row["customer_id"];
$route_id = $row["route_id"];

$pnr = $row["booking_id"];
Page 49

$customer_name = get_from_table($conn,
"customers","customer_id", $customer_id, "customer_name");

$customer_phone =
get_from_table($conn,"customers","customer_id", $customer_id, "customer_phone");

$bus_no = get_from_table($conn, "routes", "route_id", $route_id,


"bus_no");

$route = $row["customer_route"];

$booked_seat = $row["booked_seat"];

$booked_amount = $row["booked_amount"];

$dep_date = get_from_table($conn, "routes", "route_id", $route_id,


"route_dep_date");

$dep_time = get_from_table($conn, "routes", "route_id", $route_id,


"route_dep_time");

$booked_timing = $row["booking_created"];
?>
<tr>
<td>
<?php
echo $pnr;
Page 50

?>
</td>
<td>
<?php
echo $customer_name;
?>
</td>
<td>
<?php
echo $customer_phone;
?>
</td>
<td>
<?php
echo $bus_no;
?>
</td>
<td>
<?php
echo $route;
?>
</td>
<td>
<?php
echo $booked_seat;
?>
Page 51

</td>
<td>
<?php
echo '$'.$booked_amount;
?>
</td>
<td>
<?php
echo $dep_date . " , ". $dep_time;
?>
</td>
<td>
<?php
echo $booked_timing;
?>
</td>
<td>
<button class="button btn-sm edit-button" data-link="<?php echo
$_SERVER['REQUEST_URI']; ?>" data-customerid="<?php
echo $customer_id;?>" data-id="<?php
echo $id;?>" data-name="<?php
echo $customer_name;?>" data-phone="<?php
echo $customer_phone;?>" >Edit</button>
<button class="button delete-button btn-sm" data-bs-
toggle="modal" data-bs-target="#deleteModal"
data-id="<?php
echo $id;?>" data-bookedseat="<?php
Page 52

echo $booked_seat;
?>" data-routeid="<?php
echo $route_id;
?>"> Delete</button>
</td>
</tr>
<?php
}
?>
</table>
</div>
</section>
<?php } ?>
</div>
</main>
<!-- Requiring _getJSON.php-->
<!-- Will have access to variables
1. routeJson
2. customerJson
3. seatJson
4. busJson
5. adminJson
6. bookingJSON
-->
<?php require '../assets/partials/_getJSON.php';?>
Page 53

<!-- All Modals Here -->


<!-- Add Booking Modal -->
<div class="modal fade" id="addModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Make Bookings</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<form id="addBookingForm" action="<?php echo
$_SERVER['REQUEST_URI']; ?>" method="POST">
<!-- Passing Route JSON -->
<input type="hidden" id="routeJson" name="routeJson" value='<?php
echo $routeJson; ?>'>
<!-- Passing Customer JSON -->
<input type="hidden" id="customerJson" name="customerJson"
value='<?php echo $customerJson; ?>'>
<!-- Passing Seat JSON -->
<input type="hidden" id="seatJson" name="seatJson" value='<?php
echo $seatJson; ?>'>

<div class="mb-3">
<label for="cid" class="form-label">Customer ID</label>
<!-- Search Functionality -->
<div class="searchQuery">
Page 54

<input type="text" class="form-control searchInput" id="cid"


name="cid">
<div class="sugg">

</div>
</div>
</div>
<div class="mb-3">
<label for="cname" class="form-label">Customer Name</label>
<input type="text" class="form-control" id="cname" name="cname"
readonly>
</div>
<div class="mb-3">
<label for="cphone" class="form-label">Contact Number</label>
<input type="tel" class="form-control" id="cphone" name="cphone"
readonly>
</div>
<div class="mb-3">
<label for="routeSearch" class="form-label">Route</label>
<!-- Search Functionality -->
<div class="searchQuery">
<input type="text" class="form-control searchInput"
id="routeSearch" name="routeSearch">
<div class="sugg">
</div>
</div>
</div>
<!-- Send the route_id -->
Page 55

<input type="hidden" name="route_id" id="route_id">


<!-- Send the departure timing too -->
<input type="hidden" name="dep_timing" id="dep_timing">

<div class="mb-3">
<label for="sourceSearch" class="form-label">Source</label>
<!-- Search Functionality -->
<div class="searchQuery">
<input type="text" class="form-control searchInput"
id="sourceSearch" name="sourceSearch">
<div class="sugg">
</div>
</div>
</div>
<div class="mb-3">
<label for="destinationSearch" class="form-
label">Destination</label>
<!-- Search Functionality -->
<div class="searchQuery">
<input type="text" class="form-control searchInput"
id="destinationSearch" name="destinationSearch">
<div class="sugg">
</div>
</div>
</div>
<!-- Seats Diagram -->
<div class="mb-3">
Page 56

<table id="seatsDiagram">
<tr>
<td id="seat-1" data-name="1">1</td>
<td id="seat-2" data-name="2">2</td>
<td id="seat-3" data-name="3">3</td>
<td id="seat-4" data-name="4">4</td>
<td id="seat-5" data-name="5">5</td>
<td id="seat-6" data-name="6">6</td>
<td id="seat-7" data-name="7">7</td>
<td id="seat-8" data-name="8">8</td>
<td id="seat-9" data-name="9">9</td>
<td id="seat-10" data-name="10">10</td>
</tr>
<tr>
<td id="seat-11" data-name="11">11</td>
<td id="seat-12" data-name="12">12</td>
<td id="seat-131" data-name="13">13</td>
<td id="seat-14" data-name="14">14</td>
<td id="seat-15" data-name="15">15</td>
<td id="seat-16" data-name="16">16</td>
<td id="seat-17" data-name="17">17</td>
<td id="seat-18" data-name="18">18</td>
<td id="seat-19" data-name="19">19</td>
<td id="seat-20" data-name="20">20</td>
</tr>
<tr>
Page 57

<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
</tr>
<tr>
<td id="seat-21" data-name="21">21</td>
<td id="seat-22" data-name="22">22</td>
<td id="seat-23" data-name="23">23</td>
<td id="seat-24" data-name="24">24</td>
<td id="seat-25" data-name="25">25</td>
<td id="seat-26" data-name="26">26</td>
<td id="seat-27" data-name="27">27</td>
<td class="space">&nbsp;</td>
<td id="seat-28" data-name="28">28</td>
<td id="seat-29" data-name="29">29</td>
</tr>
<tr>
<td id="seat-30" data-name="30">30</td>
<td id="seat-31" data-name="31">31</td>
Page 58

<td id="seat-32" data-name="32">32</td>


<td id="seat-33" data-name="33">33</td>
<td id="seat-34" data-name="34">34</td>
<td id="seat-35" data-name="35">35</td>
<td id="seat-36" data-name="36">36</td>
<td class="space">&nbsp;</td>
<td id="seat-37" data-name="37">37</td>
<td id="seat-38" data-name="38">38</td>
</tr>
</table>
</div>
<div class="row g-3 align-items-center mb-3">
<div class="col-auto">
<label for="seatInput" class="col-form-label">Seat
Number</label>
</div>
<div class="col-auto">
<input type="text" id="seatInput" class="form-control"
name="seatInput" readonly>
</div>
<div class="col-auto">
<span id="seatInfo" class="form-text">
Select from the above figure, Maximum 1 seat.
</span>
</div>
</div>
<div class="mb-3">
Page 59

<label for="bookAmount" class="form-label">Total Amount</label>


<input type="text" class="form-control" id="bookAmount"
name="bookAmount" readonly>
</div>
<button type="submit" class="btn btn-success"
name="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<!-- Add Anything -->
</div>
</div>
</div>
</div>
<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fas fa-
exclamation-circle"></i></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<h2 class="text-center pb-4">
Are you sure?
Page 60

</h2>
<p>
Do you really want to delete this booking? <strong>This process cannot be
undone.</strong>
</p>
<!-- Needed to pass id -->
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="delete-
form" method="POST">
<input id="delete-id" type="hidden" name="id">
<input id="delete-booked-seat" type="hidden" name="booked_seat">
<input id="delete-route-id" type="hidden" name="route_id">
</form>
</div>
<div class="modal-footer d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-bs-
dismiss="modal">Cancel</button>
<button type="submit" form="delete-form" name="delete" class="btn btn-
danger">Delete</button>
</div>
</div>
</div>
</div>
<script src="../assets/scripts/admin_booking.js"></script>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
Page 61

</body>
</html>
Page 62

4.Bus Status: -

Source code: -
<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Buses</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 63

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/admin-options.php';
$page="bus";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';?>

<!-- Add, Edit and Delete Buses -->


<?php
/*
1. Check if an admin is logged in
2. Check if the request method is POST
*/
Page 64

if($loggedIn && $_SERVER["REQUEST_METHOD"] == "POST")


{
if(isset($_POST["submit"]))
{
/*
ADDING BUSES
Check if the $_POST key 'submit' exists
*/
// Should be validated client-side
$busno = $_POST["busnumber"];

$bus_exists = exist_buses($conn,$busno);
$bus_added = false;

if(!$bus_exists)
{
// Route is unique, proceed
$sql = "INSERT INTO `buses` (`bus_no`, `bus_created`) VALUES
('$busno', current_timestamp());";

$result = mysqli_query($conn, $sql);

if($result)
$bus_added = true;
}

if($bus_added)
Page 64

{
// Show success alert
echo '<div class="my-0 alert alert-success alert-dismissible fade show"
role="alert">
<strong>Successful!</strong> Bus Information Added
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
// Add the bus to seats table
$seatSql = "INSERT INTO `seats` (`bus_no`) VALUES ('$busno');";
$result = mysqli_query($conn, $seatSql);
}
else{

// Show error alert


echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Bus already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
if(isset($_POST["edit"]))
{
// EDIT ROUTES
$busno = strtoupper($_POST["busno"]);
$id = $_POST["id"];
Page 65

$id_if_bus_exists = exist_buses($conn, $busno);

if(!$id_if_bus_exists || $id == $id_if_bus_exists)


{
$updateSql = "UPDATE `buses` SET `bus_no` = '$busno' WHERE
`buses`.`id` = $id;";

$updateResult = mysqli_query($conn, $updateSql);


$rowsAffected = mysqli_affected_rows($conn);

$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "No Edits Administered!";
}

elseif($updateResult)
{
// Show success alert
$messageStatus = "success";
$messageHeading = "Successfull!";
$messageInfo = "Bus details Edited";
}
else{
Page 66

// Show error alert


$messageInfo = "Your request could not be processed due to technical
Issues from our part. We regret the inconvenience caused";
}

// MESSAGE
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else
{
// If bus details already exists
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Bus details already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}

}
if(isset($_POST["delete"]))
{
// DELETE BUS
Page 67

$id = $_POST["id"];
$bus_no = get_from_table($conn, "buses", "id", $id, "bus_no");
// Delete the bus with id => id
$deleteSql = "DELETE FROM `buses` WHERE `buses`.`id` = $id";

$deleteResult = mysqli_query($conn, $deleteSql);


$rowsAffected = mysqli_affected_rows($conn);
$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "Record Doesnt Exist";
}

elseif($deleteResult)
{
// echo $num;
// Show success alert
$messageStatus = "success";
$messageInfo = "Bus Details deleted";
$messageHeading = "Successfull!";

// Delete Bus from Seat table


$sql = "DELETE from seats WHERE bus_no='$bus_no'";
Page 68

mysqli_query($conn,$sql);
}
else{
// Show error alert
$messageInfo = "Your request could not be processed due to technical
Issues from our part. We regret the inconvenience caused";
}
// Message
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
?>
<?php
$resultSql = "SELECT * FROM `buses` ORDER BY bus_created DESC";

$resultSqlResult = mysqli_query($conn, $resultSql);

if(!mysqli_num_rows($resultSqlResult)){ ?>
<!-- Buses are not present -->
<div class="container mt-4">
<div id="noCustomers" class="alert alert-dark " role="alert">
<h1 class="alert-heading">No Buses Found!!</h1>
Page 69

<p class="fw-light">Be the first person to add one!</p>


<hr>
<div id="addCustomerAlert" class="alert alert-success" role="alert">
Click on <button id="add-button" class="button btn-
sm"type="button"data-bs-toggle="modal" data-bs-target="#addModal">ADD <i
class="fas fa-plus"></i></button> to add a bus!
</div>
</div>
</div>
<?php }
else { ?>
<!-- If Buses are present -->
<section id="bus">
<div id="head">
<h4>Bus Status</h4>
</div>
<div id="bus-results">
<div>
<button id="add-button" class="button btn-sm" type="button"data-bs-
toggle="modal" data-bs-target="#addModal">Add Bus Details <i class="fas fa-
plus"></i></button>
</div>

<table class="table table-hover table-bordered">


<thead>
<th>#</th>
<th>Bus Number</th>
<th>Actions</th>
Page 70

</thead>
<?php
$ser_no = 0;
while($row = mysqli_fetch_assoc($resultSqlResult))
{
$ser_no++;
// echo "<pre>";
// var_export($row);
// echo "</pre>";

$id = $row["id"];
$busno = $row["bus_no"];
?>
<tr>
<td>
<?php
echo $ser_no;
?>
</td>
<td>
<?php
echo $busno;
?>
</td>
<td>
<button class="button edit-button " data-link="<?php echo
$_SERVER['REQUEST_URI']; ?>" data-id="<?php
Page 71

echo $id;?>" data-busno="<?php


echo $busno;?>"
>Edit</button>
<button class="button delete-button" data-bs-
toggle="modal" data-bs-target="#deleteModal" data-id="<?php
echo $id;?>">Delete</button>
</td>
</tr>
<?php
}
?>
</table>
</div>
</section>
<?php } ?>
</div>
</main>
<!-- All Modals Here -->
<!-- Add Buses Modal -->
<div class="modal fade" id="addModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add A Bus</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
Page 72

</div>
<div class="modal-body">
<form id="addBusForm" action="<?php echo
$_SERVER['REQUEST_URI']; ?>" method="POST">
<div class="mb-3">
<label for="busnumber" class="form-label">Bus
Number</label><br>

</span>
<input type="text" class="form-control" id="busnumber"
name="busnumber" required>
<span id="error" class="error">
</div>
<button type="submit" class="btn btn-success"
name="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<!-- Add Anything -->
</div>
</div>
</div>
</div>
<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
Page 73

<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fas fa-
exclamation-circle"></i></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<h2 class="text-center pb-4">
Are you sure?
</h2>
<p>
Do you really want to delete this bus? <strong>This process cannot be
undone.</strong>
</p>
<!-- Needed to pass id -->
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="delete-
form" method="POST">
<input id="delete-id" type="hidden" name="id">
</form>
</div>
<div class="modal-footer d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-bs-
dismiss="modal">Cancel</button>
<button type="submit" form="delete-form" name="delete" class="btn btn-
danger">Delete</button>
</div>
</div>
</div>
Page 74

</div>
<!-- External JS -->
<script src="../assets/scripts/admin_bus.js"></script>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
</body>
</html>
Page 75

5.Customer: -

Source code: -
<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customers</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 76

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/admin-options.php';
$page="customer";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';?>

<!-- Add, Edit and Delete Customers -->


<?php
/*
1. Check if an admin is logged in
2. Check if the request method is POST
*/
Page 77

if($loggedIn && $_SERVER["REQUEST_METHOD"] == "POST")


{
if(isset($_POST["submit"]))
{
/*
ADDING Customers
Check if the $_POST key 'submit' exists
*/
// Should be validated client-side
$cname = $_POST["cfirstname"] . " " . $_POST["clastname"];
$cphone = $_POST["cphone"];

$customer_exists = exist_customers($conn,$cname,$cphone);
$customer_added = false;

if(!$customer_exists)
{
// Route is unique, proceed
$sql = "INSERT INTO `customers` (`customer_name`, `customer_phone`,
`customer_created`) VALUES ('$cname', '$cphone', current_timestamp());";
$result = mysqli_query($conn, $sql);
// Gives back the Auto Increment id
$autoInc_id = mysqli_insert_id($conn);
// If the id exists then,
if($autoInc_id)
{
$code = rand(1,99999);
Page 78

// Generates the unique userid


$customer_id = "CUST-".$code.$autoInc_id;

$query = "UPDATE `customers` SET `customer_id` = '$customer_id'


WHERE `customers`.`id` = $autoInc_id;";
$queryResult = mysqli_query($conn, $query);

if(!$queryResult)
echo "Not Working";
}

if($result)
$customer_added = true;
}

if($customer_added)
{
// Show success alert
echo '<div class="my-0 alert alert-success alert-dismissible fade show"
role="alert">
<strong>Successful!</strong> Customer Added
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else{
// Show error alert
Page 79

echo '<div class="my-0 alert alert-danger alert-dismissible fade show"


role="alert">
<strong>Error!</strong> Customer already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
if(isset($_POST["edit"]))
{
// EDIT ROUTES
$cname = $_POST["cname"];
$cphone = $_POST["cphone"];
$id = $_POST["id"];
$id_if_customer_exists = exist_customers($conn,$cname,$cphone);

if(!$id_if_customer_exists || $id == $id_if_customer_exists)


{
$updateSql = "UPDATE `customers` SET
`customer_name` = '$cname',
`customer_phone` = '$cphone' WHERE `customers`.`customer_id` = '$id';";

$updateResult = mysqli_query($conn, $updateSql);


$rowsAffected = mysqli_affected_rows($conn);

$messageStatus = "danger";
$messageInfo = "";
Page 80

$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "No Edits Administered!";
}

elseif($updateResult)
{
// Show success alert
$messageStatus = "success";
$messageHeading = "Successfull!";
$messageInfo = "Customer details Edited";
}
else{
// Show error alert
$messageInfo = "Your request could not be processed due to technical
Issues from our part. We regret the inconvenience caused";
}

// MESSAGE
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
Page 81

}
else{
// If customer details already exists
echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Customer already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}

}
if(isset($_POST["delete"]))
{
// DELETE ROUTES
$id = $_POST["id"];
// Delete the route with id => id
$deleteSql = "DELETE FROM `customers` WHERE `customers`.`id` = $id";

$deleteResult = mysqli_query($conn, $deleteSql);


$rowsAffected = mysqli_affected_rows($conn);
$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "Record Doesnt Exist";
Page 82

elseif($deleteResult)
{
$messageStatus = "success";
$messageInfo = "Customer Details deleted";
$messageHeading = "Successfull!";
}
else{

$messageInfo = "Your request could not be processed due to technical


Issues from our part. We regret the inconvenience caused";
}

// Message
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
?>
<?php
$resultSql = "SELECT * FROM `customers` ORDER BY customer_created
DESC";
Page 83

$resultSqlResult = mysqli_query($conn, $resultSql);

if(!mysqli_num_rows($resultSqlResult)){ ?>
<!-- Customers are not present -->
<div class="container mt-4">
<div id="noCustomers" class="alert alert-dark " role="alert">
<h1 class="alert-heading">No Customers Found!!</h1>
<p class="fw-light">Be the first person to add one!</p>
<hr>
<div id="addCustomerAlert" class="alert alert-success" role="alert">
Click on <button id="add-button" class="button btn-
sm"type="button"data-bs-toggle="modal" data-bs-target="#addModal">ADD <i
class="fas fa-plus"></i></button> to add a customer!
</div>
</div>
</div>
<?php }
else { ?>
<!-- If Customers are present -->
<section id="customer">
<div id="head">
<h4>Customer Status</h4>
</div>
<div id="customer-results">
<div>
<button id="add-button" class="button btn-sm"type="button"data-bs-
toggle="modal" data-bs-target="#addModal">Add Customer Details <i class="fas fa-
plus"></i></button>
Page 84

</div>
<table class="table table-hover table-bordered">
<thead>
<th>ID</th>
<th>Name</th>
<th>Contact</th>
<th>Actions</th>
</thead>
<?php
while($row = mysqli_fetch_assoc($resultSqlResult))
{
// echo "<pre>";
// var_export($row);
// echo "</pre>";
$id = $row["id"];
$customer_id = $row["customer_id"];
$customer_name = $row["customer_name"];
$customer_phone = $row["customer_phone"];
?>
<tr>
<td>
<?php
echo $customer_id;
?>
</td>
<td>
Page 85

<?php
echo $customer_name;
?>
</td>
<td>
<?php
echo $customer_phone;
?>
</td>
<td>
<button class="button edit-button " data-link="<?php echo
$_SERVER['REQUEST_URI']; ?>" data-id="<?php
echo $customer_id;?>" data-name="<?php
echo $customer_name;?>" data-phone="<?php
echo $customer_phone;?>"
>Edit</button>
<button class="button delete-button" data-bs-
toggle="modal" data-bs-target="#deleteModal" data-id="<?php
echo $id;?>">Delete</button>
</td>
</tr>
<?php
}
?>
</table>
</div>
</section>
Page 86

<?php } ?>
</div>
</main>
<!-- All Modals Here -->
<!-- Add Route Modal -->
<div class="modal fade" id="addModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add A Customer</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<form id="addCustomerForm" action="<?php echo
$_SERVER['REQUEST_URI']; ?>" method="POST">
<div class="mb-3">
<label for="cfirstname" class="form-label">Customer
Firstname</label>
<input type="text" class="form-control" id="cfirstname"
name="cfirstname">
</div>
<div class="mb-3">
<label for="clastname" class="form-label">Customer
Lastname</label>
<input type="text" class="form-control" id="clastname"
name="clastname">
</div>
Page 87

<div class="mb-3">
<label for="cphone" class="form-label">Contact Number</label>
<input type="tel" class="form-control" id="cphone" name="cphone">
</div>
<button type="submit" class="btn btn-success"
name="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<!-- Add Anything -->
</div>
</div>
</div>
</div>
<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fas fa-
exclamation-circle"></i></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<h2 class="text-center pb-4">
Are you sure?
Page 88

</h2>
<p>
Do you really want to delete these customer details? <strong>This process
cannot be undone.</strong>
</p>
<!-- Needed to pass id -->
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="delete-
form" method="POST">
<input id="delete-id" type="hidden" name="id">
</form>
</div>
<div class="modal-footer d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-bs-
dismiss="modal">Cancel</button>
<button type="submit" form="delete-form" name="delete" class="btn btn-
danger">Delete</button>
</div>
</div>
</div>
</div>
<!-- External JS -->
<script src="../assets/scripts/admin_customer.js"></script>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
</body>
</html>
Page 89

6.Route status: -

Source Code: -
<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Routes</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 90

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/admin-options.php';
$page="route";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';?>

<!-- Add, Edit and Delete Routes -->


<?php
/*
1. Check if an admin is logged in
2. Check if the request method is POST
*/
Page 91

if($loggedIn && $_SERVER["REQUEST_METHOD"] == "POST")


{
if(isset($_POST["submit"]))
{
/*
ADDING ROUTES
Check if the $_POST key 'submit' exists
*/
// Should be validated client-side
$viaCities = strtoupper($_POST["viaCities"]);
$cost = $_POST["stepCost"];
$deptime = $_POST["dep_time"];
$depdate = $_POST["dep_date"];
$busno = $_POST["busno"];
$route_exists = exist_routes($conn,$viaCities,$depdate, $deptime);
$route_added = false;

if(!$route_exists)
{
// Route is unique, proceed
$sql = "INSERT INTO `routes` (`route_cities`,
`bus_no`,
`route_dep_date`,
`route_dep_time`, `route_step_cost`, `route_created`) VALUES
('$viaCities','$busno', '$depdate','$deptime', '$cost', current_timestamp());";
$result = mysqli_query($conn, $sql);
Page 92

// Gives back the Auto Increment id


$autoInc_id = mysqli_insert_id($conn);
// If the id exists then,
if($autoInc_id)
{
$code = rand(1,99999);
// Generates the unique userid
$route_id = "RT-".$code.$autoInc_id;

$query = "UPDATE `routes` SET `route_id` = '$route_id' WHERE


`routes`.`id` = $autoInc_id;";
$queryResult = mysqli_query($conn, $query);
if(!$queryResult)
echo "Not Working";
}

if($result)
{
$route_added = true;
// The bus is now assigned, updating uses table
bus_assign($conn, $busno);
}
}

if($route_added)
{
// Show success alert
Page 93

echo '<div class="my-0 alert alert-success alert-dismissible fade show" role="alert">


<strong>Successful!</strong> Route Added
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else{

// Show error alert


echo '<div class="my-0 alert alert-danger alert-dismissible fade show"
role="alert">
<strong>Error!</strong> Route already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
if(isset($_POST["edit"]))
{
// EDIT ROUTES
$viaCities = strtoupper($_POST["viaCities"]);
$cost = $_POST["stepCost"];
$id = $_POST["id"];
$deptime = $_POST["dep_time"];
$depdate = $_POST["dep_date"];
$busno = $_POST["busno"];
$oldBusNo = $_POST["old-busno"];
Page 94

$id_if_route_exists = exist_routes($conn,$viaCities,$depdate,$deptime);

if(!$id_if_route_exists || $id == $id_if_route_exists)


{
$updateSql = "UPDATE `routes` SET
`route_cities` = '$viaCities',
`bus_no`='$busno',
`route_dep_date` = '$depdate',
`route_dep_time` = '$deptime',
`route_step_cost` = '$cost' WHERE `routes`.`id` = '$id';";

$updateResult = mysqli_query($conn, $updateSql);


$rowsAffected = mysqli_affected_rows($conn);

$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "No Edits Administered!";
}

elseif($updateResult)
{
// To assign the new bus, and free the old one - this should only reun
when the bus no is edited.
Page 95

if($oldBusNo != $busno)
{
bus_assign($conn,$busno);
bus_free($conn, $oldBusNo);
}
// Show success alert
$messageStatus = "success";
$messageHeading = "Successfull!";
$messageInfo = "Route details Edited";
}
else{
// Show error alert
$messageInfo = "Your request could not be processed due to technical
Issues from our part. We regret the inconvenience caused";
}

// MESSAGE
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
else
{
// If route details already exists
Page 96

echo '<div class="my-0 alert alert-danger alert-dismissible fade show" role="alert">


<strong>Error!</strong> Route details already exists
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}

}
if(isset($_POST["delete"]))
{
// DELETE ROUTES
$id = $_POST["id"];
// Get the bus_no from route_id
$busno_toFree = busno_from_routeid($conn, $id);
// Delete the route with id => id
$deleteSql = "DELETE FROM `routes` WHERE `routes`.`id` = $id";
$deleteResult = mysqli_query($conn, $deleteSql);
$rowsAffected = mysqli_affected_rows($conn);
$messageStatus = "danger";
$messageInfo = "";
$messageHeading = "Error!";

if(!$rowsAffected)
{
$messageInfo = "Record Doesnt Exist";
}
Page 97

elseif($deleteResult)
{
// echo $num;
// Show success alert
$messageStatus = "success";
$messageInfo = "Route Details deleted";
$messageHeading = "Successfull!";
// Free the bus assigned
bus_free($conn, $busno_toFree);
}
else{
// Show error alert
$messageInfo = "Your request could not be processed due to technical
Issues from our part. We regret the inconvenience caused";
}
// Message
echo '<div class="my-0 alert alert-'.$messageStatus.' alert-dismissible fade
show" role="alert">
<strong>'.$messageHeading.'</strong> '.$messageInfo.'
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-
label="Close"></button>
</div>';
}
}
?>
<?php
$resultSql = "SELECT * FROM `routes` ORDER BY route_created DESC";
Page 98

$resultSqlResult = mysqli_query($conn, $resultSql);


if(!mysqli_num_rows($resultSqlResult)){ ?>
<!-- Routes are not present -->
<div class="container mt-4">
<div id="noRoutes" class="alert alert-dark " role="alert">
<h1 class="alert-heading">No Routes Found!!</h1>
<p class="fw-light">Be the first person to add one!</p>
<hr>
<div id="addRouteAlert" class="alert alert-success" role="alert">
Click on <button id="add-button" class="button btn-
sm"type="button"data-bs-toggle="modal" data-bs-target="#addModal">ADD <i
class="fas fa-plus"></i></button> to add a route!
</div>
</div>
</div>
<?php }
else { ?>
<!-- Routes Are present -->
<section id="route">
<div id="head">
<h4>Route Status</h4>
</div>
<div id="route-results">
<div>
<button id="add-button" class="button btn-sm"type="button"data-bs-
toggle="modal" data-bs-target="#addModal">Add Route Details <i class="fas fa-
plus"></i></button>
Page 99

</div>
<table class="table table-hover table-bordered">
<thead>
<th>ID</th>
<th>Via Cities</th>
<th>Bus</th>
<th>Departure Date</th>
<th>Departure Time</th>
<th>Cost</th>
<th>Actions</th>
</thead>
<?php
while($row = mysqli_fetch_assoc($resultSqlResult))
{
// echo "<pre>";
// var_export($row);
// echo "</pre>";
$id = $row["id"];
$route_id = $row["route_id"];
$route_cities = $row["route_cities"];
$route_dep_time = $row["route_dep_time"];
$route_dep_date = $row["route_dep_date"];
$route_step_cost = $row["route_step_cost"];
$bus_no = $row["bus_no"];
?>
<tr>
Page 100

<td>
<?php
echo $route_id;
?>
</td>
<td>
<?php
echo $route_cities;
?>
</td>
<td>
<?php
echo $bus_no;
?>
</td>
<td>
<?php
echo $route_dep_date;
?>
</td>
<td>
<?php
echo $route_dep_time;
?>
</td>
<td>
Page 101

<?php
echo '$'.$route_step_cost;?>
</td>
<td>
<button class="button edit-button " data-link="<?php echo
$_SERVER['REQUEST_URI']; ?>" data-id="<?php
echo $id;?>" data-cities="<?php
echo $route_cities;?>" data-cost="<?php
echo $route_step_cost;?>" data-date="<?php
echo $route_dep_date;
?>" data-time="<?php
echo $route_dep_time;
?>" data-busno="<?php
echo $bus_no;
?>"
>Edit</button>
<button class="button delete-button" data-bs-
toggle="modal" data-bs-target="#deleteModal" data-id="<?php
echo $id;?>">Delete</button>
</td>
</tr>
<?php
}
?>
</table>
</div>
</section>
Page 102

<?php }
?>
</div>
</main>
<?php
$busSql = "Select * from buses where bus_assigned=0";
$resultBusSql = mysqli_query($conn, $busSql);
$arr = array();
while($row = mysqli_fetch_assoc($resultBusSql))
$arr[] = $row;
$busJson = json_encode($arr);
?>
<!-- Add Route Modal -->
<div class="modal fade" id="addModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add A Route</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<form id="addRouteForm" action="<?php echo
$_SERVER['REQUEST_URI']; ?>" method="POST">
<div class="mb-3">
<label for="viaCities" class="form-label">Via Cities</label>
Page 103

<input type="text" class="form-control" id="viaCities" name="viaCities"


placeholder="Comma Separated List" required>
<span id="error">

</span>
</div>
<input type="hidden" id="busJson" name="busJson" value='<?php
echo $busJson; ?>'>
<div class="mb-3">
<label for="busno" class="form-label">Bus Number</label>
<!-- Search Functionality -->
<div class="searchBus">
<input type="text" class="form-control busnoInput" id="busno"
name="busno" required>
<div class="sugg">
</div>
</div>
</div>
<div class="mb-3">
<label for="stepCost" class="form-label">Cost</label>
<input type="number" class="form-control" id="stepCost"
name="stepCost" required>
</div>
<div class="mb-3">
<label for="date" class="form-label">Departure Date</label>
<input type="date" name="dep_date" id="date" min="<?php
date_default_timezone_set("Asia/Kolkata");
echo date("Y-m-d");?>" value="
Page 104

<?php
echo date("Y-m-d");
?>
" required>
</div>
<div class="mb-3">
<label for="time" class="form-label">Departure Time</label>
<input type="time" name="dep_time" id="time" min="
<?php
echo date("H:i");
?>
" required>
</div>
<button type="submit" class="btn btn-success"
name="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<!-- Add Anything -->
</div>
</div>
</div>
</div>
<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
Page 105

<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fas fa-
exclamation-circle"></i></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-
label="Close"></button>
</div>
<div class="modal-body">
<h2 class="text-center pb-4">
Are you sure?
</h2>
<p>
Do you really want to delete this route? <strong>This process cannot be
undone.</strong>
</p>
<!-- Needed to pass id -->
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="delete-
form" method="POST">
<input id="delete-id" type="hidden" name="id">
</form>
</div>
<div class="modal-footer d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-bs-
dismiss="modal">Cancel</button>
<button type="submit" form="delete-form" name="delete" class="btn btn-
danger">Delete</button>
</div>
</div>
Page 106

</div>
</div>
<!-- External JS -->
<script src="../assets/scripts/admin_routes.js"></script>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
</body>
</html>
Page 107

7.Seat Status: -

<!-- Show these admin pages only when the admin is logged in -->
<?php require '../assets/partials/_admin-check.php'; ?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seats</title>
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
Page 108

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500
&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG
2x" crossorigin="anonymous">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/d8cfbe84b9.js"
crossorigin="anonymous"></script>
<!-- External CSS -->
<?php
require '../assets/styles/admin.php';
require '../assets/styles/admin-options.php';
$page="seat";
?>
</head>
<body>
<!-- Requiring the admin header files -->
<?php require '../assets/partials/_admin-header.php';?>
<?php
$busSql = "Select * from buses";
$resultBusSql = mysqli_query($conn, $busSql);
$arr = array();
while($row = mysqli_fetch_assoc($resultBusSql))
$arr[] = $row;
$busJson = json_encode($arr);
Page 109

?>

<section id="seat">
<div id="head">
<h4>Seat Status</h4>
</div>
<div id="main">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<div class="searchBus">
<input type="text" id="bus-no" name="bus-no" placeholder="Bus
Number"
class="busnoInput">
<div class="sugg">
</div>
</div>

<!-- Sending busJson -->


<input type="hidden" id="busJson" name="busJson" value='<?php echo
$busJson; ?>'>
<button type="submit" name="submit">Search</button>
</form>
<div id="seat-results">
<?php
if(isset($_GET["submit"]))
{
$busno = $_GET["bus-no"];
$sql = "SELECT * FROM seats WHERE bus_no='$busno'";
Page 110

$result = mysqli_query($conn, $sql);

$booked_seats = false;
if(mysqli_num_rows($result))
{
$row = mysqli_fetch_assoc($result);
$booked_seats = $row["seat_booked"];
}
if($booked_seats)
{ ?>
<table id="displaySeats" data-seats="<?php echo $booked_seats;
?>">
<tr>
<td id="seat-1" data-name="1">1</td>
<td id="seat-2" data-name="2">2</td>
<td id="seat-3" data-name="3">3</td>
<td id="seat-4" data-name="4">4</td>
<td id="seat-5" data-name="5">5</td>
<td id="seat-6" data-name="6">6</td>
<td id="seat-7" data-name="7">7</td>
<td id="seat-8" data-name="8">8</td>
<td id="seat-9" data-name="9">9</td>
<td id="seat-10" data-name="10">10</td>
</tr>
<tr>
<td id="seat-11" data-name="11">11</td>
<td id="seat-12" data-name="12">12</td>
Page 111

<td id="seat-131" data-name="13">13</td>


<td id="seat-14" data-name="14">14</td>
<td id="seat-15" data-name="15">15</td>
<td id="seat-16" data-name="16">16</td>
<td id="seat-17" data-name="17">17</td>
<td id="seat-18" data-name="18">18</td>
<td id="seat-19" data-name="19">19</td>
<td id="seat-20" data-name="20">20</td>
</tr>
<tr>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
<td class="space">&nbsp;</td>
</tr>
<tr>
<td id="seat-21" data-name="21">21</td>
<td id="seat-22" data-name="22">22</td>
<td id="seat-23" data-name="23">23</td>
<td id="seat-24" data-name="24">24</td>
Page 112

<td id="seat-25" data-name="25">25</td>


<td id="seat-26" data-name="26">26</td>
<td id="seat-27" data-name="27">27</td>
<td class="space">&nbsp;</td>
<td id="seat-28" data-name="28">28</td>
<td id="seat-29" data-name="29">29</td>
</tr>
<tr>
<td id="seat-30" data-name="30">30</td>
<td id="seat-31" data-name="31">31</td>
<td id="seat-32" data-name="32">32</td>
<td id="seat-33" data-name="33">33</td>
<td id="seat-34" data-name="34">34</td>
<td id="seat-35" data-name="35">35</td>
<td id="seat-36" data-name="36">36</td>
<td class="space">&nbsp;</td>
<td id="seat-37" data-name="37">37</td>
<td id="seat-38" data-name="38">38</td>
</tr>
</table>
<div style="text-align: center; color: #9a031e; font-weight: bold;">
<?php
echo $busno;
?>
</div>
<?php }
Page 113

// If booked_seats is empty
else { ?>
<p>No seat Booked</p>
<?php }
}
?>
</div>
</div>
</section>
</div>
</main>
<script src="../assets/scripts/admin_seat.js"></script>
</body>
</html>
Data Base File (MySQL File): -
CREATE TABLE `bookings` (
`id` int(100) NOT NULL,
`booking_id` varchar(255) NOT NULL,
`customer_id` varchar(255) NOT NULL,
`route_id` varchar(255) NOT NULL,
`customer_route` varchar(200) NOT NULL,
`booked_amount` int(100) NOT NULL,
`booked_seat` varchar(100) NOT NULL,
`booking_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Page 114

-
-
-- Dumping data for table `bookings`
--

INSERT INTO `bookings` (`id`, `booking_id`, `customer_id`, `route_id`,


`customer_route`, `booked_amount`, `booked_seat`, `booking_created`) VALUES
(60, 'TBZJ360', 'CUST-2114034', 'RT-1908653', 'CITY1 &rarr; CITY2', 100, '3', '2021-10-
16 22:15:13'),
(61, 'QK0MT61', 'CUST-2017936', 'RT-9941455', 'EDROISCHESTER &rarr; BRUGOW',
110, '15', '2021-10-17 22:36:10'),
(62, 'A8L5662', 'CUST-5585037', 'RT-3835554', 'ZEKA &rarr; ZREGOW', 70, '2', '2021-
10-18 00:08:51'),
(63, 'QDNGC63', 'CUST-8996235', 'RT-3835554', 'ZEKA &rarr; ZREGOW', 70, '15',
'2021-10-18 09:31:30'),
(64, 'X34RW64', 'CUST-9474738', 'RT-3835554', 'ZEKA &rarr; ZREGOW', 70, '6', '2021-
10-18 09:32:21'),
(65, 'JKZVT65', 'CUST-4031139', 'RT-3835554', 'ZEKA &rarr; ZREGOW', 70, '18',
'2021-10-18 09:33:36'),
(66, 'HIIAN66', 'CUST-9997540', 'RT-5887160', 'FLORIA &rarr; ARKBY', 118, '16',
'2021-10-18 09:40:16'),
(67, 'QLOE167', 'CUST-9997540', 'RT-3835554', 'ZEKA &rarr; ZREGOW', 70, '12',
'2021-10-18 09:41:01');

-- --------------------------------------------------------

--
-- Table structure for table `buses`
--
Page 115

CREATE TABLE `buses` (


`id` int(100) NOT NULL,
`bus_no` varchar(255) NOT NULL,
`bus_assigned` tinyint(1) NOT NULL DEFAULT '0',
`bus_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `buses`
--

INSERT INTO `buses` (`id`, `bus_no`, `bus_assigned`, `bus_created`) VALUES


(44, 'MVL1000', 0, '2021-10-16 22:05:16'),
(45, 'ABC0010', 1, '2021-10-17 22:32:46'),
(46, 'XYZ7890', 0, '2021-10-17 22:33:15'),
(47, 'BCC9999', 0, '2021-10-17 22:33:22'),
(48, 'RDH4255', 1, '2021-10-17 22:33:36'),
(49, 'TTH8888', 1, '2021-10-18 00:05:32'),
(50, 'MMM9969', 1, '2021-10-18 00:06:02'),
(51, 'LLL7699', 1, '2021-10-18 00:06:42'),
(52, 'SSX6633', 0, '2021-10-18 00:06:52'),
(53, 'NBS4455', 0, '2021-10-18 09:27:49'),
(54, 'CAS3300', 1, '2021-10-18 09:36:54');

-- --------------------------------------------------------
-- Page 116

-- Table structure for table `customers`


--

CREATE TABLE `customers` (


`id` int(100) NOT NULL,
`customer_id` varchar(255) NOT NULL,
`customer_name` varchar(30) NOT NULL,
`customer_phone` varchar(10) NOT NULL,
`customer_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` (`id`, `customer_id`, `customer_name`, `customer_phone`,


`customer_created`) VALUES
(34, 'CUST-2114034', 'Dfirst Dlast', '7002001200', '2021-10-16 22:09:12'),
(35, 'CUST-8996235', 'Willian Hobbs', '4012222222', '2021-10-17 22:30:23'),
(36, 'CUST-2017936', 'George Watts', '7011111111', '2021-10-17 22:30:53'),
(37, 'CUST-5585037', 'Bobb Horn', '1111111110', '2021-10-17 22:31:20'),
(38, 'CUST-9474738', 'Alan Moore', '7900000000', '2021-10-18 09:32:02'),
(39, 'CUST-4031139', 'Jamie Rhoades', '1003000010', '2021-10-18 09:33:08'),
(40, 'CUST-9997540', 'Demo Customer', '7777777700', '2021-10-18 09:39:10');

-- --------------------------------------------------------
-- Page 117

-- Table structure for table `routes`


--

CREATE TABLE `routes` (


`id` int(100) NOT NULL,
`route_id` varchar(255) NOT NULL,
`bus_no` varchar(155) NOT NULL,
`route_cities` varchar(255) NOT NULL,
`route_dep_date` date NOT NULL,
`route_dep_time` time NOT NULL,
`route_step_cost` int(100) NOT NULL,
`route_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `routes`
--

INSERT INTO `routes` (`id`, `route_id`, `bus_no`, `route_cities`, `route_dep_date`,


`route_dep_time`, `route_step_cost`, `route_created`) VALUES
(53, 'RT-1908653', 'MVL1000', 'CITY1,CITY2', '2021-10-17', '22:05:00', 100, '2021-10-
16 22:05:42'),
(54, 'RT-3835554', 'MMM9969', 'ZEKA,ZREGOW', '2021-10-19', '23:13:00', 70, '2021-
10-16 22:12:32'),
(55, 'RT-9941455', 'RDH4255', 'EDROISCHESTER,BRUGOW', '2021-10-18', '10:00:00',
110, '2021-10-17 22:34:47'),
(56, 'RT-9069556', 'XYZ7890', 'ANTALAND,ZREGOW', '2021-10-19', '11:40:00', 85,
'2021-10-17 23:39:57'),
Page 118

(57, 'RT-775557', 'ABC0010', 'ENCEFORD,VLIRGINIA', '2021-10-19', '13:30:00', 131,


'2021-10-17 23:42:12'),
(58, 'RT-753558', 'TTH8888', 'ARKBY,VEIM', '2021-10-20', '12:04:00', 55, '2021-10-18
00:04:42'),
(59, 'RT-6028759', 'LLL7699', 'BELRITH,ARKBY', '2021-10-20', '13:50:00', 166, '2021-
10-18 00:07:50'),
(60, 'RT-5887160', 'CAS3300', 'FLORIA,ARKBY', '2021-10-19', '10:30:00', 118, '2021-
10-18 09:38:30');

-- --------------------------------------------------------

--
-- Table structure for table `seats`
--

CREATE TABLE `seats` (


`bus_no` varchar(155) NOT NULL,
`seat_booked` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `seats`
--

INSERT INTO `seats` (`bus_no`, `seat_booked`) VALUES


('ABC0010', NULL),
('BCC9999', NULL),
('CAS3300', '16'),
Page 119

('LLL7699', NULL),
('MMM9969', '2,15,6,18,12'),
('MVL1000', '3'),
('NBS4455', NULL),
('RDH4255', '15'),
('SSX6633', NULL),
('TTH8888', NULL),
('XYZ7890', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (


`user_id` int(11) NOT NULL,
`user_fullname` varchar(100) NOT NULL,
`user_name` varchar(30) NOT NULL,
`user_password` varchar(255) NOT NULL,
`user_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `users`
--
Page 120

INSERT INTO `users` (`user_id`, `user_fullname`, `user_name`, `user_password`,


`user_created`) VALUES
(1, 'Liam Moore', 'admin',
'$2y$10$7rLSvRVyTQORapkDOqmkhetjF6H9lJHngr4hJMSM2lHObJbW5EQh6', '2021-
06-02 13:55:21'),
(2, 'Test Admin', 'testadmin',
'$2y$10$A2eGOu1K1TSBqMwjrEJZg.lgy.FmCUPl/l5ugcYOXv4qKWkFEwcqS', '2021-
10-17 21:10:07');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `buses`
--
ALTER TABLE `buses`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customers`
-- Page 121

ALTER TABLE `customers`


ADD PRIMARY KEY (`id`);

--
-- Indexes for table `routes`
--
ALTER TABLE `routes`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `seats`
--
ALTER TABLE `seats`
ADD PRIMARY KEY (`bus_no`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
Page 122

-- AUTO_INCREMENT for table `bookings`


--
ALTER TABLE `bookings`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68;
--
-- AUTO_INCREMENT for table `buses`
--
ALTER TABLE `buses`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55;
--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `routes`
--
ALTER TABLE `routes`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=61;
--
-- AUTO_INCREMENT for table `users`
--ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS
*/;/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Page 123

9.Limitation of Project:

• The system will not provide facility to pay the fine online by means of credit card/
Net banking.

• User has to pay the fine manually to account department or fine information can
be send to

• account department to debit the required amount from his salary.

• You need internet access. Reliable internet access is required to check reservations
and add bookings that are made over the phone.

• You need to be ready for an influx of new customers.

• Not all online booking systems are created equal.


Page 124

10.Future scope of the project:

1. Anyone can book any bus company ticket from our system in the easiest way.

2. Let’s have a look of today’s ticketing system!

3. Search option of source and destination place.

4. Other Existing Systems • paribahan.com

5. Complexity and error in the existing system Existing System Sign Up Members
Search from place to destination No suggestion/ Pop up See Available
coaches/Buses No choices for seat or view Buy ticket YES NO Very easy
signup/Verification and sign in Almost all the available payment gateway.

6. Future Scope • As mentioned above, although our system had been completed
but it is not perfect, we had planned to make some enhancement in the future. •
We think that our system still has potential to grow. Besides, we will include
more functions and introduce more widgets to the system. Like ▫ Mobile aps ▫
Mobile version ▫ Home Delivery ▫ Call Center Support We also plan to enhance
the interface so that it looks more attractive and interactive.
Page 125

11.Conclusion

• It can be observed that computer applications are very important in every field of
human endeavor.

• Here all the information about customer that made reservation can be gotten just by
clicking a button with this new system, some of the difficulties encountered with the
manual system are overcome.

• It will also reduce the workload of the staff, reduce the time used for making
reservation at the bus terminal and also increase efficiency.

• The application also has the ability to update records in various files automatically
thereby relieving the company’s staff the stress of working from file security of data.
Page 126

Bibliography

Books:

1. World Wide Web with HTML, C Xavier, McGraw Hill, New Delhi

2. Complete HTML, BPB Publications, New Delhi

3. PHP and MySQL, Steve Suehring, Tim Converse & Joyce Park, Wiley India Pvt. Ltd.

4. PHP and MySQL, Joel Murach & Ray Harris, Murach ‘s, Shroff Publishers, Delhi.

YouTube:

1. CodeWithHarry
2. papa programmer

You might also like