Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM tomcat:8.5-jdk8

ENV JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m"

RUN apt-get update && apt-get install -y wget unzip && rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN mkdir -p build/web/WEB-INF/classes build/web/WEB-INF/lib

COPY Project/TurkishAirlines/Libs/*.jar build/web/WEB-INF/lib/

RUN wget -O build/web/WEB-INF/lib/servlet-api.jar https://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar

RUN wget -O build/web/WEB-INF/lib/webservices-rt.jar https://repo1.maven.org/maven2/org/glassfish/metro/webservices-rt/2.4.10/webservices-rt-2.4.10.jar

COPY Project/TurkishAirlines/src/java/ src/

COPY Project/TurkishAirlines/web/ web/

COPY Project/TurkishAirlines/src/java/airlines.accdb build/web/WEB-INF/classes/

RUN javac -cp "build/web/WEB-INF/lib/*" -d build/web/WEB-INF/classes src/*.java src/*/*.java

RUN cp -r web/* build/web/

COPY tomcat-users.xml $CATALINA_HOME/conf/

RUN mkdir -p $CATALINA_HOME/webapps/TurkishAirlines

RUN cp -r build/web/* $CATALINA_HOME/webapps/TurkishAirlines/

EXPOSE 8080

CMD ["catalina.sh", "run"]
2 changes: 1 addition & 1 deletion Project/TurkishAirlines/src/java/SContextListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void contextInitialized(ServletContextEvent event)

try
{
p = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getPath() + "\\airlines.accdb";
p = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getPath() + "/airlines.accdb";
}
catch (URISyntaxException ex)
{
Expand Down
216 changes: 55 additions & 161 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,183 +1,77 @@
# Flight Booking System for Airlines (Java Web Application) ✈️


<a href="https://github.com/harismuneer"><img alt="views" title="Github views" src="https://komarev.com/ghpvc/?username=harismuneer&style=flat-square" width="125"/></a>
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](#)
[![GitHub Forks](https://img.shields.io/github/forks/harismuneer/Flight-Booking-System-JavaServlets_App.svg?style=social&label=Fork&maxAge=2592000)](https://www.github.com/harismuneer/Flight-Booking-System-JavaServlets_App/fork)
[![GitHub Issues](https://img.shields.io/github/issues/harismuneer/Flight-Booking-System-JavaServlets_App.svg?style=flat&label=Issues&maxAge=2592000)](https://www.github.com/harismuneer/Flight-Booking-System-JavaServlets_App/issues)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat&label=Contributions&colorA=red&colorB=black )](#)
# Sistema de Reserva de Voos - Turkish Airlines ✈️

Sistema web completo de reserva de voos para a Turkish Airlines, desenvolvido em **Java Servlets** e **JSP** seguindo a arquitetura **MVC**. A aplicação inclui autenticação e autorização baseada em roles do Tomcat, além de proteções contra **SQL Injection** e **Cross-Site Scripting (XSS)**.

A **fully responsive** web-based Flight Booking System for Turkish Airlines based on the **Model View Controller (MVC) Architecture** made using **Java Servlets**, **Java Server Pages (JSPs)**. Moreover authentication and authorization for users is implemented using Tomcat Roles. The web-application is also secured against **SQL Injection** and **Cross-Site Scripting** attacks.

## Technologies Used
## 🎯 O que a Aplicação Faz

* **Frontend:** HTML, CSS, JavaScript, Jquery, Bootstrap, Java Server Pages (JSPs), AJAX (for a Flight Search Widget)
* **Backend:** Java Servlets, Java Models, Microsoft Access (Database)
* **Webservices:** SOAP Web Services (to get price and number of seats)
* **Security Features:** SQL Injection, Cross-Site Scripting (XSS), Tomcat Roles
Este é um sistema de reserva de voos onde uma companhia aérea vende assentos aos clientes via internet. A aplicação possui **3 tipos de usuários** com diferentes funcionalidades:

## Roles
Following roles are implemented:
* Airline Admin
* Airline Manager
* Customer
### 👥 Tipos de Usuários

## Workflow (Functionalities)
1. **Admin (Administrador)**
- Gerencia recursos da aplicação
- Altera funcionalidades
- Define assentos disponíveis

This is for just one airline who wants to sell seats to their customers via internet.

Following are the steps of work flow:
1. Airline Admin will set the prices of the seats. There should be three types of seats:
* First Class
* Business
* Economy
2. The Airline Admin should be able to create and update the features of each type of seat.
3. The Airline Admin should be able to set the total number of seats for each flight.
4. Airline Manager should see a list of seats which the Admin has added or edited when he/she logs in.
5. Airline Manager then needs to approve the new price or updates.
6. When the price and update is approved by the manager only then it should be available for the customer to buy.
7. The Customer should be able to buy seats based on availability.
8. When a customer buys a ticket the system should be able to calculate how many seats are left. If all seats are bought the application should not let the customers buy
more seats.
9. The Customer should be able to select the following, to select a seat:
* origin and destination cities
* dates of travel
* number of people traveling
10. When the customer selects the seat and confirms the booking flight Itinerary should
be shown to the customer.
11. When the customer approves the itinerary the customer should be taken to a payment page where the total price should be shown. When the customer presses
the pay button consider the transaction done and mark the seat sold.
12. Once the seat is sold, send out an email to the customer with the flight itinerary.
2. **Manager (Gerente)**
- Aprova ou desaprova recursos
- Aprova ou desaprova assentos
- Gerencia aprovações

## Interface
3. **Customer (Cliente)**
- Pesquisa voos disponíveis
- Faz reservas de voos
- Visualiza reservas atuais
- Escolhe assentos

#### Home Pages
<p align="middle">
<img src="../master/Images/main.png" width="400"/>
<img src="../master/Images/main2.png" width="400"/>
</p>
## 🛠️ Tecnologias Utilizadas

#### Login Page and Book Flight
<p align="middle">
<img src="../master/Images/login.png" width="400"/>
<img src="../master/Images/book.png" width="400"/>
</p>
- **Frontend:** HTML, CSS, JavaScript, jQuery, Bootstrap, JSP, AJAX
- **Backend:** Java Servlets, Java Models
- **Banco de Dados:** Microsoft Access
- **Web Services:** SOAP (para preços e número de assentos)
- **Segurança:** Proteção contra SQL Injection e XSS

#### Current Bookings and Itinerary
<p align="middle">
<img src="../master/Images/current.png" width="400"/>
<img src="../master/Images/itenary.png" width="400"/>
</p>
## 🚀 Como Executar

#### Seat Features and Approval
<p align="middle">
<img src="../master/Images/features.png" width="400"/>
<img src="../master/Images/approve.png" width="400"/>
</p>
### Pré-requisitos
- Docker instalado no computador

### Passos para Executar

## How to Run
1. **Clone o repositório** (se ainda não fez)
2. **Execute no terminal:**
```bash
docker-compose up -d
```
3. **Aguarde alguns segundos** para a aplicação inicializar
4. **Acesse no navegador:** `http://localhost:8080/TurkishAirlines/`

1- Install these:
* [Java SE Development Kit 8 (JDK 8)](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
* After installing JDK 8, install [NetBeans IDE](https://netbeans.org/downloads/) with **all** the features including **Tomcat Apache Server.**
### Passos para Parar Execução

2- Open Netbeans IDE and go to Services > Servers > Apache Tomcat. Right click "Apache Tomcat" and select Properties. Copy the **Catalina Base Path** and open it. Open the "conf" folder and then the "**tomcat-users.xml**" file there. Copy the following lines and paste them in the tomcat-users.xml file before closing tag </tomcat-users>
1. **Execute no terminal:**
```bash
docker-compose down
```

```
<role rolename="Manager"/>
<role rolename="Admin"/>
<role rolename="Customer"/>
### 🔑 Credenciais para Teste

<user username="[email protected]" password="a" roles="Admin"/>
<user username="[email protected]" password="m" roles="Manager"/>
<user username="[email protected]" password="c" roles="Customer"/>
```
Use estas credenciais para fazer login e testar as diferentes funcionalidades:

<p align="middle">
<img src="../master/Images/tomcat.png" width="400"/>
<img src="../master/Images/tomcat-users-xml.png" width="400"/>
</p>
| Tipo de Usuário | Email | Senha | Funcionalidade |
|----------------|-------|-------|----------------|
| **Admin** | `[email protected]` | `a` | Gerenciar recursos |
| **Manager** | `[email protected]` | `m` | Aprovar recursos |
| **Customer** | `[email protected]` | `c` | Fazer reservas |

Morever, open and read the file. Only the users authenticated in this file are allowed to login and use the Booking System. Use above mentioned credentials to login through the Login Page.
## 📝 Notas

3- Restart NetBeans IDE. Click on File -> Open Project and browse to the downloaded folder named "Project". There will be two projects there "Turkish Airlines" and "WSTester" (which is basically a project to test the Web Services). Select both and open them.
Both projects will be loaded. Now first run the Turkish Airlines project, then to test the web services run WSTester project.
- A aplicação usa **autenticação baseada em roles** do Tomcat
- Todas as páginas protegidas redirecionam para login automaticamente
- O sistema possui validações de entrada para prevenir ataques
- Os dados são persistidos em banco Microsoft Access
- Web Services SOAP são utilizados para consultas de preços

---


<br>
<hr>
<h1 align="left">Hey there, I'm <a href="https://www.linkedin.com/in/harismuneer/">Haris </a><img src="https://media.giphy.com/media/hvRJCLFzcasrR4ia7z/giphy.gif" width="28">
<a href="https://github.com/harismuneer/Ultimate-Facebook-Scraper"><img align="right" src="https://user-images.githubusercontent.com/30947706/79588950-17515780-80ee-11ea-8f66-e26da49fa052.png" alt="Ultimate Facebook Scraper (UFS)" width="200"/></a> - Maker of Things</h1>


### Creator of <a href="https://github.com/harismuneer/Ultimate-Facebook-Scraper">Ultimate Facebook Scraper</a> (one of the best software to collect Facebook data for research & analysis)

<hr>

<h2 align="left">🌐 Connect</h2>
<p align="left">
<a href="https://www.linkedin.com/in/harismuneer/"><img title="Follow on LinkedIn" src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white"/></a>
<a href="https://www.facebook.com/harism99"><img title="Connect on Facebook" src="https://img.shields.io/badge/Facebook-1877F2?style=for-the-badge&logo=facebook&logoColor=white"/></a>
<a href="https://twitter.com/harismuneer99"><img title="Follow on Twitter" src="https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white"/></a>
<a href="mailto:[email protected]"><img title="Email" src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white"/></a>
<a href="https://github.com/harismuneer"><img title="Follow on GitHub" src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white"/></a>
<a href="https://www.instagram.com/harismuneer99"><img title="Follow on Instagram" src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white"/></a>
<a href="https://www.youtube.com/channel/UCZ-uBd7g0E2Bp-0tXtSlSjw?sub_confirmation=1"><img title="Subscribe on YouTube" src="https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white"/></a>
</p>


## 🤝 Consulting / Coaching
Stuck with some problem? Need help in solution development, guidance, training or capacity building? I am a Full Stack Engineer turned Project Manager with years of technical and leadership experience in a diverse range of technologies and domains. Let me know what problem you are facing at <b>[email protected]</b> and we can schedule a consultation meeting to help you get through it.

## 👨‍💻 Technical Skills & Expertise

- Development of Web Applications, Mobile Applications, and Desktop Applications
- Development of Machine Learning/Deep Learning models, and deployment
- Web Scraping, Browser Automation, Python Scripting
<hr>



## ❤️ Support / Donations
If you or your company use any of my projects, like what I’m doing or have benefited from my projects in any way then kindly consider backing my efforts.

For donations, you can follow these simple steps:

<b>1)</b> Free signup at <b>[TransferWise](https://transferwise.com/invite/u/harism95)</b> using this link: https://transferwise.com/invite/u/harism95</li>. (Signing up through this link will save you from any transcation fee on the donation)

<b>2)</b> Select the amount e.g (15$) and choose the receiving/recipient's currency to be PKR. It supports multiple payment options (credit card, debit card, wire transfer etc)

<b>3)</b> Then it will show my info as the recipient, select it. If my name isn't shown, then type my email [email protected] in recipients.

<b>4)</b> Choose the reason for transfer to the one that suits you the most (in this case it could be 'General expenses') and in the reference section, you can mention 'Support'

If you face any issue in sending donation then feel free to get in touch with me at [email protected]

Thank you for your contribution!



## Author
You can get in touch with me on my LinkedIn Profile: [![LinkedIn Link](https://img.shields.io/badge/Connect-harismuneer-blue.svg?logo=linkedin&longCache=true&style=social&label=Follow)](https://www.linkedin.com/in/harismuneer)

You can also follow my GitHub Profile to stay updated about my latest projects: [![GitHub Follow](https://img.shields.io/badge/Connect-harismuneer-blue.svg?logo=Github&longCache=true&style=social&label=Follow)](https://github.com/harismuneer)

If you liked the repo then kindly support it by giving it a star ⭐ and share in your circles so more people can benefit from the effort.

## Contributions Welcome
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](#)

If you find any bug in the code or have any improvements in mind then feel free to generate a pull request.

## Issues
[![GitHub Issues](https://img.shields.io/github/issues/harismuneer/Flight-Booking-System-JavaServlets_App.svg?style=flat&label=Issues&maxAge=2592000)](https://www.github.com/harismuneer/Flight-Booking-System-JavaServlets_App/issues)

If you face any issue, you can create a new issue in the Issues Tab and I will be glad to help you out.

## License
[![MIT](https://img.shields.io/cocoapods/l/AFNetworking.svg?style=style&label=License&maxAge=2592000)](../master/LICENSE)

Copyright (c) 2018-present, harismuneer
**Desenvolvido por:** Haris Muneer
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'

services:
turkish-airlines:
build: .
ports:
- "8080:8080"
volumes:
- ./Project/TurkishAirlines/src/java/airlines.accdb:/usr/local/tomcat/webapps/TurkishAirlines/WEB-INF/classes/airlines.accdb
17 changes: 17 additions & 0 deletions tomcat-users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1">

<!-- Roles para a aplicação Turkish Airlines -->
<role rolename="Manager"/>
<role rolename="Admin"/>
<role rolename="Customer"/>

<!-- Usuários com suas respectivas roles -->
<user username="[email protected]" password="a" roles="Admin"/>
<user username="[email protected]" password="m" roles="Manager"/>
<user username="[email protected]" password="c" roles="Customer"/>

</tomcat-users>