199 lines
7.4 KiB
PHP
199 lines
7.4 KiB
PHP
<html>
|
|
<head>
|
|
<title>RoamEase</title>
|
|
<link rel="shortcut icon" href="../../icon/favicon/favicon.ico" type="image/x-icon" />
|
|
<link rel="icon" href="../../icon/favicon/favicon.ico" type="image/x-icon" />
|
|
<link rel="stylesheet" href="./home.css?version=1" type="text/css" />
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<style>
|
|
.hotel{
|
|
background-color:rgba(355,355,355,0.7);
|
|
width:800px;
|
|
margin:0 auto;
|
|
cursor:pointer;
|
|
}
|
|
.searchBox{
|
|
padding: 5%;
|
|
font-size: 16px;
|
|
border: none;
|
|
border-radius: 20px;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
width: auto;
|
|
|
|
}
|
|
.searchB{
|
|
padding: 2% 5%;
|
|
font-size: 120%;
|
|
background-color: #003b94;;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 20px;
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
}
|
|
.searchB:hover {
|
|
cursor: pointer;
|
|
text-decoration: underline;
|
|
}
|
|
.buttonDiv{
|
|
text-align:center;
|
|
}
|
|
.back{
|
|
margin-top:10%;
|
|
height:90%;
|
|
width:100%;
|
|
}
|
|
table tr td:first-child {
|
|
width: 120px;
|
|
}
|
|
.dropbox{
|
|
padder:10px;
|
|
background-color:white;
|
|
box-shadow: 2px 2px 5px #999;
|
|
width:100%;
|
|
height:10%;
|
|
font-size:20px;
|
|
border-radius:10px;
|
|
transition: all .2s ease-in-out;
|
|
}
|
|
</STYLE>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
include "../ConnectDB.php";
|
|
// Start the session
|
|
session_start();
|
|
// Check if the user is already logged in
|
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
|
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'staff'){
|
|
echo "<script type='text/javascript'>
|
|
window.top.location.href = './staff/home.php';
|
|
</script>";
|
|
}
|
|
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'admin'){
|
|
echo "<script type='text/javascript'>
|
|
window.top.location.href = './admin/home.php';
|
|
</script>";
|
|
}
|
|
}
|
|
?>
|
|
|
|
<header>
|
|
<div class="logo">
|
|
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
|
</div>
|
|
|
|
<div class="nav-links">
|
|
<a><input class="searchBox" type="text" id="destinationCity" placeholder="search destination city"></a>
|
|
<button class="searchB" onclick="myFunction()">Search</button>
|
|
<?php
|
|
if (isset($_SESSION['loggedin'])) {
|
|
echo '<a href="./process/cart.php">Cart</a>
|
|
<a href="../../login/login.php">Account</a>';
|
|
}
|
|
else {
|
|
echo '<a href="../../login/register.php">Sign up</a>
|
|
<a href="../../login/username.php">Log in</a>';
|
|
}
|
|
?>
|
|
</div>
|
|
</header>
|
|
|
|
<header>
|
|
<nav>
|
|
<a href="stays.php">
|
|
<img src="../../icon/header/stays.svg" alt="Stays">
|
|
</a>
|
|
<a href="transport.php" style="border-color: white;">
|
|
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
|
</a>
|
|
<a href="foods.php">
|
|
<img src="../../icon/header/foods.svg" alt="Foods">
|
|
</a>
|
|
<a href="attractions.php">
|
|
<img src="../../icon/header/attractions.svg" alt="Attractions">
|
|
</a>
|
|
<a href="guiding.php">
|
|
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
|
</a>
|
|
<a href="plans.php">
|
|
<img src="../../icon/header/plans.svg" alt="Plans">
|
|
</a>
|
|
</nav>
|
|
</header>
|
|
|
|
<br>
|
|
<p style="font-size:30px; color:blue; ">Book for <i><span style="color:red; font-weight:bold;">Plane</span></i><p>
|
|
<p style="color:black; font-size:40px;">Please select your departure city by <select style="height:5%; vertical-align:top; border-radius:10px;"><option>DROP BOX</option></select>
|
|
and use the <img src="../../img/transport/9.png" alt="Facebook" style="height: 5%;"> to find your destination</p>
|
|
<a>
|
|
<select id="departureCity" class="dropbox">
|
|
<?php
|
|
$result = mysqli_query($conn, "SELECT DISTINCT cities.name,cities.id FROM transport_airport JOIN cities ON transport_airport.city_id=cities.id GROUP BY city_id HAVING COUNT(airport_id)>3;");
|
|
while($row = mysqli_fetch_assoc($result)){
|
|
echo '<option class="content" value="'.$row['id'].'">Departure city: '.$row['name'].'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</a><br><br><br><br>
|
|
<div id="pageContainer"></div>
|
|
<script>
|
|
function myFunction() {
|
|
var input = document.getElementById('destinationCity');
|
|
var departureCity = document.getElementById('departureCity').value;
|
|
var destinationCity = input.value.toUpperCase();
|
|
var xmlhttp = new XMLHttpRequest();
|
|
xmlhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
var response = JSON.parse(this.responseText);
|
|
var data = response.data;
|
|
var html = '';
|
|
var time=response.time;
|
|
time=time.toFixed(6);
|
|
if (data[0]=="No result"){
|
|
html="<p style='text-align:center; font-size:40px;'>Sorry, we didn't find what you were looking for.</p>";
|
|
}else{
|
|
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the flight information you are looking for.</div><br><br>';
|
|
html+='Running time: '+time+'s';
|
|
for (var i = 0; i < data.length; i++) {
|
|
html += '<div class="hotel" style="width:80%;cursor:default;">';
|
|
html += '<table style="border: none; cursor:pointer;" onclick="window.open(\'./getInfo/FlInfo.php?id=' + data[i].flight_id + '\', \'_blank\');">';
|
|
html += '<tr style="border-top-left-radius:10px; border-top-right-radius:10px;"><td >Flight code</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].flight_code + '</p></td></tr>';
|
|
html += '<tr style="border-top-left-radius:10px; border-top-right-radius:10px;"><td >Airline</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].air_name + '</p></td></tr>';
|
|
html += '<tr><td style="width: 300px;"><p style="width:150px;">Departure city:</p></td><td><p style=" width:300px; font-size:30px;"><i><b>' + data[i].from_name + '</p></b></i></td>';
|
|
html += '<td><img src="../../img/transport/10.png" width=140; height=90; alt="image"></td>';
|
|
html += '<td><p style="width:150px;">Destination city:</p></td><td><i><b><p style="width:300px;font-size:30px;">' + data[i].dest_name + '</p></b></i></td></tr>';
|
|
html += '</table>';
|
|
html += '</div><br>';
|
|
}
|
|
}
|
|
document.getElementById("pageContainer").innerHTML = html;
|
|
}
|
|
};
|
|
xmlhttp.open("GET", "getFlight.php?departureCity="+departureCity+"&destinationCity="+destinationCity, true);
|
|
xmlhttp.send();
|
|
document.getElementById("pageContainer").innerHTML = '<object type="text/html" data="../../animation/loading.html" ></object>';
|
|
}
|
|
</script>
|
|
|
|
|
|
<footer>
|
|
<div class="logo">
|
|
<a href="../../index.php"><img src="../../icon/favicon/textlogo.svg" alt="RoamEase" height="50px"></a>
|
|
<p style="font-size:10%;">©2023 COMP3013 Group10</p>
|
|
</div>
|
|
|
|
<div class="nav-links" style="font-size: 80%;">
|
|
<a href="#" style="color: white; margin: 0 10px;">About us</a>
|
|
<a href="#" style="color: white; margin: 0 10px;">Privacy Policy</a>
|
|
<a href="#" style="color: white; margin: 0 10px;">Terms For Usage</a>
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
|
|
</html>
|