Bus Ticket Booking System - Docx New

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

BUS TICKETING AND PAYMENT SYSTEM

Abstract:
Our project is dedicated to utilizing the potential of cloud computing to transform bus ticketing
and payment systems radically. Through cutting-edge cloud technologies, we aim to develop an
advanced and scalable ticketing platform tailored explicitly for public transportation, promising
unprecedented convenience and efficiency. The heart of our initiative lies in crafting a robust
cloud-based system capable of handling ticket bookings, payments, and passenger management
seamlessly. Leveraging cloud computing techniques ensures high availability, scalability, and
security, facilitating smooth transactions and effective service management.

Our vision is to translate complex transportation data into actionable insights for providers. We
envision a user-friendly interface enabling passengers to book tickets seamlessly and make
secure online payments. This interface acts as a vital link between cloud technology and public
transportation services, providing providers with timely information to make informed decisions
and enhance operational efficiency.

In conclusion, our project represents a significant leap forward in applying cloud computing to
public transportation, with bus ticketing and payment as the focal point. Through collaboration,
innovation, and a commitment to ethical principles, we aim to equip transportation providers
with advanced tools to revolutionize the management and utilization of public transportation.
Together, we can pave the way for a more efficient and passenger-friendly future.

Cloud computing in Bus Ticket Booking System:

Implementing cloud computing in a bus ticket booking system offers numerous advantages,
including scalability, reliability, cost-effectiveness, and enhanced performance. Here's how it can
be integrated:

1. Scalability:

 Allocate resources based on demand


 Handle peak traffic efficiently
 Scale down during off-peak times

2. Reliability:

 Built-in redundancy and failover mechanisms


 High availability through multiple data centers
 Mitigate downtime risk

3. Cost-effectiveness:

 Pay-as-you-go model
 Reduce upfront infrastructure costs
 Optimize resource utilization

4. Performance:

 Global network of data centers


 Low-latency experiences worldwide
 Content delivery networks (CDNs) for faster delivery

5. Security:

 Enterprise-grade security features


 Encryption and access controls
 Threat detection systems

6. Flexibility:

 Experiment with new features and technologies


 Provision development and testing environments on-demand
 Faster time-to-market for new features

7. Data Analytics:

 Gain insights into customer behavior


 Optimize operations
 Drive business decisions

8. Disaster Recovery:

 Automated backups and geo-replication


 Ensure business continuity
 Mitigate data loss and system failures
Framework for Cloud computing in Bus Ticket Booking System:
Designing a framework for cloud computing in a bus ticket booking system involves
structuring the system architecture and identifying the key components and
interactions. Here's a high-level framework:

1. Cloud Provider Selection:

 Evaluate different cloud service providers (e.g., AWS, Azure, Google Cloud)
based on factors like pricing, performance, and available services.
 Select a cloud provider that best suits the requirements of the bus ticket
booking system.

2. Infrastructure Setup:

 Provision necessary infrastructure resources on the chosen cloud platform,


such as virtual machines, storage, and networking components.
 Configure security groups, firewalls, and access controls to ensure a secure
environment.

3. Application Deployment:

 Containerize the bus ticket booking application using technologies like


Docker or Kubernetes for easier deployment and management.
 Deploy the application to the cloud infrastructure, considering factors like
load balancing, auto-scaling, and fault tolerance.

4. Database Management:

 Utilize managed database services offered by the cloud provider (e.g.,


Amazon RDS, Azure SQL Database) for storing booking data securely.
 Configure backup and disaster recovery mechanisms to ensure data
integrity and availability.

5. Scalability and Elasticity:

 Implement auto-scaling policies to dynamically adjust resources based on


demand fluctuations.
 Utilize cloud-native services like AWS Lambda or Google Cloud Functions
for serverless execution of certain tasks, reducing operational overhead
and cost.

6. Monitoring and Logging:

 Set up monitoring tools (e.g., Amazon CloudWatch, Azure Monitor) to


track system performance, resource utilization, and application health.
 Configure logging to capture relevant system events and user activities for
troubleshooting and auditing purposes.

7. Security and Compliance:

 Implement encryption mechanisms to protect sensitive data both in transit


and at rest.
 Adhere to industry-standard security practices and compliance
requirements (e.g., PCI DSS for payment processing) to ensure data
security and regulatory compliance.

8. Integration with Third-party Services:

 Integrate with external services such as payment gateways, messaging


services, and geolocation APIs to enhance the functionality of the booking
system.
 Utilize cloud-native integration solutions (e.g., AWS API Gateway, Azure
Logic Apps) for seamless integration and workflow automation.

9. Disaster Recovery and Backup:

 Implement backup and recovery procedures to minimize data loss and


downtime in the event of system failures or disasters.
 Utilize geo-replication and multi-region deployment strategies for high
availability and disaster recovery.

10. Continuous Integration/Continuous Deployment (CI/CD):

 Set up CI/CD pipelines to automate the build, test, and deployment


processes, enabling faster delivery of new features and updates.
 Integrate with version control systems (e.g., Git) and CI/CD tools (e.g.,
Jenkins, Travis CI) for streamlined development workflows.

System Requirements:

Hardware Requirement:

High-performance computing hardware (e.g., multi-core CPU, GPU,


or specialized cloud servers) is essential for handling cloud-based applications and databases,
along with a minimum of 4 GB RAM.

Software Requirements:

The system is compatible with various operating systems such as Windows, Linux, or macOS,
and can be developed using AWS, Google Cloud Platform (GCP), or Microsoft Azure.

Tools and Versions:

We'll utilize the following tools and their respective versions:

AWS SDK - Version: 2.17.0


Docker - Version: 20.10.11
Flask - Version: 2.0.2
PostgreSQL - Version: 13.4.

FLOWCHART:
CODING:

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

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

<!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>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+AMvyTG2x"
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"])
{
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);

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">

<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>
<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>
</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);


$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);

$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">SBTBS</a>
<!-- <a href="#" class="nav-item">Gallery</a> -->
</div>

<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>

<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>
<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">
<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>
Lorem ipsum dolor sit amet consecteturadipisicing elit. Perferendis soluta voluptas
eaque, numquam veritatis aperiam expedita deleniti, nesciunt cum alias velit. Cupiditate
commodi
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus cum nisi ea
optio unde aliquam quia reprehenderit atque eum tenetur!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sed placeat debitis corporis
voluptates modi quibusdam quidem voluptatibus illum, maiores sequi.
</p>
</div>
</section>
<section id="contact">
<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 csbs
</p>
</footer>
</div>

<!-- 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">
<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>
OUTPUT:

Conclusion

The development of a bus ticket booking system utilizing cloud computing offers a range of
benefits that significantly enhance the efficiency, scalability, and user experience of the service.
The primary advantages include:

Scalability: Cloud infrastructure allows the system to handle varying loads seamlessly, ensuring
that during peak times, the service remains available and responsive.
Cost-Effectiveness: By leveraging cloud services, the system reduces the need for extensive
on-premise hardware and maintenance costs. Pay-as-you-go models further optimize
operational costs.
Reliability and Availability: Cloud platforms offer robust uptime guarantees and disaster recovery
options, ensuring that the ticket booking system is always accessible to users.
Flexibility: The system can be easily updated and maintained without significant downtime. New
features and updates can be rolled out efficiently.
Data Security and Compliance: Cloud providers often have advanced security measures and
compliance certifications, ensuring that user data is protected according to the latest standards.
Integration Capabilities: The cloud environment facilitates integration with various third-party
services such as payment gateways, maps, and customer support systems, enhancing the
overall functionality.
Future Scope
The bus ticket booking system can be further enhanced and expanded in several ways to
provide a more comprehensive and advanced service:

AI and Machine Learning:


Implementing AI algorithms to predict demand and adjust pricing dynamically.
Utilizing machine learning for personalized recommendations and targeted promotions to users.
Mobile Optimization and Applications:

Developing native mobile applications with offline capabilities to cater to users with intermittent
internet access.
Enhancing the mobile user experience with intuitive interfaces and features like real-time
tracking of buses.
Blockchain Integration:

Leveraging blockchain technology for secure and transparent transactions, ensuring data
integrity and reducing fraud.
Advanced Analytics:

Using big data analytics to gain insights into user behavior, preferences, and operational
efficiencies.
Implementing real-time analytics for monitoring system performance and user satisfaction.
Enhanced User Experience:

Incorporating virtual assistants or chatbots for customer support to provide instant assistance.
Offering more flexible payment options, including digital wallets and cryptocurrencies.
Internet of Things (IoT):

Integrating IoT devices to provide real-time data on bus locations, traffic conditions, and seat
availability.
Enabling smart bus stops with digital displays showing arrival times and other relevant
information.
Geographic Expansion:

Scaling the system to cover more regions and incorporate various modes of transportation,
including trains and ride-sharing services.
Offering multi-modal transportation options and seamless ticketing for end-to-end journey
planning.
Sustainability Initiatives:

Promoting eco-friendly transportation options and providing information on the carbon footprint
of journeys.
Implementing features that encourage users to opt for greener travel alternatives.
By continuously innovating and incorporating these advanced technologies and features, the
bus ticket booking system can stay ahead in the competitive market, providing exceptional
service to users and adapting to their evolving needs.

You might also like