Initial Commit
This commit is contained in:
15
indexes/ConnectDB.php
Normal file
15
indexes/ConnectDB.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$servername = "localhost";
|
||||
$username = "roamease";
|
||||
$password = "fHWaAJ54BimD4z7x";
|
||||
$db = "roamease";
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $db);
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
// echo "Connected successfully";
|
||||
?>
|
||||
70
indexes/aboutus.php
Normal file
70
indexes/aboutus.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<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="./user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="#">CNY</a>
|
||||
<a href="#">Search</a>
|
||||
<?php
|
||||
if (isset($_SESSION['loggedin'])) {
|
||||
echo '<a href="#">Cart</a><a href="#">Account</a>';
|
||||
}
|
||||
else {
|
||||
echo '<a href="#">Sign up</a><a href="../login/username.php">Log in</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="plans.php">
|
||||
<img src="../icon/header/plans.svg" alt="Plans">
|
||||
</a>
|
||||
<a href="stays.php">
|
||||
<img src="../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<h1>Statements</h1>
|
||||
|
||||
<br><br><br><br><br><br>
|
||||
|
||||
<footer>
|
||||
<img src="../icon/favicon/logo_white.svg" alt="RoamEase" width="300px">
|
||||
<div style="margin: 20px 0;">
|
||||
<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>
|
||||
<p>© 2023 COMP3013 Group10. All rights reserved.</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
101
indexes/admin/adminbuyer.php
Normal file
101
indexes/admin/adminbuyer.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Profile</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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
</head>
|
||||
<style>
|
||||
|
||||
#message {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../../indexes/user/process/cart.php">Cart</a>
|
||||
<a href="../../login/logout.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/attractions.svg" alt="Attractions">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="message">
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$ID = $_POST["buyers"];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM user_buyer
|
||||
WHERE u_id='$ID'";
|
||||
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo "delete successfully! Running time: ".$execution_time."s";
|
||||
// Add a line break for readability
|
||||
echo "<br>";
|
||||
echo '<a href="home.php">Return home</a>'; // Fixed echo statement
|
||||
} else {
|
||||
echo "Sorry! nobody coule be found!";
|
||||
}
|
||||
|
||||
// Close the database connection after using it
|
||||
$conn->close();
|
||||
?>
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
|
||||
</div>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
99
indexes/admin/adminguide.php
Normal file
99
indexes/admin/adminguide.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Profile</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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
</head>
|
||||
<style>
|
||||
|
||||
#message {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../../indexes/user/process/cart.php">Cart</a>
|
||||
<a href="../../login/logout.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/attractions.svg" alt="Attractions">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
<div id="message">
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$ID = $_POST["guides"];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM user_guide
|
||||
WHERE u_id='$ID'";
|
||||
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo "delete successfully! Running time: ".$execution_time."s";
|
||||
// Add a line break for readability
|
||||
echo "<br>";
|
||||
echo '<a href="home.php">Return home</a>'; // Fixed echo statement
|
||||
} else {
|
||||
echo "Sorry! nobody coule be found!";
|
||||
}
|
||||
|
||||
// Close the database connection after using it
|
||||
$conn->close();
|
||||
?>
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
</div>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
97
indexes/admin/adminselect.php
Normal file
97
indexes/admin/adminselect.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Profile</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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
</head>
|
||||
<style>
|
||||
|
||||
#message {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
}
|
||||
</style>
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../../indexes/user/process/cart.php">Cart</a>
|
||||
<a href="../../login/logout.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/attractions.svg" alt="Attractions">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="message">
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$ID = $_POST["sellers"];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM user_seller
|
||||
WHERE u_id='$ID'";
|
||||
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo "delete successfully! Running time: ".$execution_time."s";
|
||||
// Add a line break for readability
|
||||
echo "<br>";
|
||||
echo '<a href="home.php">Return home</a>'; // Fixed echo statement
|
||||
} else {
|
||||
echo "Sorry! nobody coule be found!";
|
||||
}
|
||||
|
||||
// Close the database connection after using it
|
||||
$conn->close();
|
||||
?>
|
||||
<br><br><br><br>
|
||||
<br><br><br><br>
|
||||
</div>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
0
indexes/admin/home.css
Normal file
0
indexes/admin/home.css
Normal file
209
indexes/admin/home.php
Normal file
209
indexes/admin/home.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<html>
|
||||
<style>
|
||||
.left {
|
||||
position: absolute;
|
||||
top: 1000px;
|
||||
left: 50px;
|
||||
}
|
||||
</style>
|
||||
<head>
|
||||
<title>Profile</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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../../login/login.php">Account</a>
|
||||
<a href="../../login/logout.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/attractions.svg" alt="Attractions">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!--header-->
|
||||
|
||||
<?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'] === 'seller'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../seller/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>";
|
||||
}
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'guide'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../guide/home.php';
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<body>
|
||||
<div style="text-align: center; border: 2px solid #ccc; padding: 20px;">
|
||||
<p style="font-size: larger;">Admin page</p>
|
||||
<form action=adminselect.php method="POST">
|
||||
<label for="sellers">ban a seller</label>
|
||||
<input type="text" name="sellers" placeholder="input the id you want to delete">
|
||||
<br>
|
||||
<input type="submit" name="submit" value="delete sellers">
|
||||
|
||||
<br><br>
|
||||
</form>
|
||||
<form action=adminbuyer.php method="POST">
|
||||
<label>ban a buyer</label>
|
||||
<input type="text" name="buyers" placeholder="input the id you want to delete">
|
||||
<br>
|
||||
<input type="submit" name="submit" value="delete buyers">
|
||||
</form>
|
||||
<form action=adminguide.php method="POST">
|
||||
<label>ban a guide</label>
|
||||
<input type="text" name="guides" placeholder="input the id you want to delete">
|
||||
<br>
|
||||
<input type="submit" name="submit" value="delete guide">
|
||||
</form>
|
||||
</div>
|
||||
<div style="text-align: center; border: 2px solid #ccc; padding: 20px;">
|
||||
<p style="font-size: larger;"><b>Data Aanalysis</b></p>
|
||||
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// data analysis
|
||||
$query = "SELECT attraction_id, COUNT(attraction_id) AS attribute_count FROM attraction_booking GROUP BY attraction_id ORDER BY attribute_count DESC LIMIT 1";
|
||||
$result = $conn->query($query);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
$row = $result->fetch_assoc();
|
||||
$most_common_attribute_value = $row['attraction_id'];
|
||||
|
||||
// the most popular,times
|
||||
|
||||
echo "The most popular attraction is:" . $most_common_attribute_value . ",the times is:" . $row['attribute_count'] . "<br>";
|
||||
|
||||
// all information
|
||||
$query_all_info = "SELECT * FROM attraction_booking JOIN attraction USING(attraction_id) WHERE attraction_id = '$most_common_attribute_value'";
|
||||
$result_all_info = $conn->query($query_all_info);
|
||||
|
||||
if ($result_all_info->num_rows > 0) {
|
||||
echo '<div style="display: flex; justify-content: center; align-items: center; height: 100vh;">';
|
||||
echo '<table style="border-collapse: collapse; width: 50%; text-align: center; border: 1px solid #ddd;">';
|
||||
echo '<tr><th style="border: 1px solid #ddd;">attraction_id</th><th style="border: 1px solid #ddd;">Name</th></tr>';
|
||||
|
||||
while ($row_info = $result_all_info->fetch_assoc()) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $row_info['attraction_id'] . '</td>';
|
||||
echo '<td>' . $row_info['name'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo 'No information found for the most common attribute value.';
|
||||
}
|
||||
} else {
|
||||
echo "No records found";
|
||||
}
|
||||
?>
|
||||
<div class='left'>
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
// data analysis
|
||||
$query = "SELECT restaurant_id, COUNT(restaurant_id) AS restaurant_count FROM restaurant_booking GROUP BY restaurant_id ORDER BY restaurant_count DESC LIMIT 1";
|
||||
$result = $conn->query($query);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
$row = $result->fetch_assoc();
|
||||
$most_common_attribute_value = $row['restaurant_id'];
|
||||
|
||||
$query_all_info = "SELECT * FROM restaurant_booking JOIN restaurant USING(restaurant_id) WHERE restaurant_id = '$most_common_attribute_value'";
|
||||
$result_all_info = $conn->query($query_all_info);
|
||||
|
||||
if ($result_all_info->num_rows > 0) {
|
||||
|
||||
echo '<div style="display: flex; justify-content: center; align-items: center; height: 100vh; text-align:center;">';
|
||||
echo '<table style="border-collapse:collapse; margin-bottom:-30%; margin-left:-20%;collapse; width: 50%; text-align: center; border: 1px solid #ddd;">';
|
||||
echo '<tr><th style="border: 1px solid #ddd;">restaurant_id</th><th style="border: 1px solid #ddd;">Name</th></tr>';
|
||||
echo "<p style='margin-left:-2%;'>The most popular restaurant is:" . $most_common_attribute_value . ",the times is:" . $row['restaurant_count'] . "<br></p>";
|
||||
while ($row_info = $result_all_info->fetch_assoc()) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $row_info['restaurant_id'] . '</td>';
|
||||
echo '<td>' . $row_info['name'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo 'No information found for the most common attribute value.';
|
||||
}
|
||||
} else {
|
||||
echo "No records found";
|
||||
}
|
||||
|
||||
// Close database connection
|
||||
$conn->close();
|
||||
?>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
120
indexes/modify/seller_add/attractions.php
Normal file
120
indexes/modify/seller_add/attractions.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Attraction</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="h_name">Attraction name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="h_name" name="h_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city">City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="city" name="city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="opentime">Open time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="opentime" name="opentime" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="closetime">Close time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="closetime" name="closetime" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="ticket">Ticket:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="ticket" name="ticket" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="ticket">Children ticket:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="ticket" name="ticket" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="ticket">Special ticket:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="ticket" name="ticket" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="type">Type:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="type" name="type" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="tags">Tags:</label></td>
|
||||
<td style="text-align: left"><textarea id="tags" name="tags" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Attraction</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
116
indexes/modify/seller_add/foods.php
Normal file
116
indexes/modify/seller_add/foods.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Restaurant</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="h_name">Restaurant name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="h_name" name="h_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city">City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="city" name="city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="opentime">Open time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="opentime" name="opentime" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="closetime">Close time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="closetime" name="closetime" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="type">Type:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="type" name="type" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="fee">Fee:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="fee" name="fee" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="style">Style:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="style" name="style" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="tags">Tags:</label></td>
|
||||
<td style="text-align: left"><textarea id="tags" name="tags" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Restaurant</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
104
indexes/modify/seller_add/guiding.php
Normal file
104
indexes/modify/seller_add/guiding.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Guide</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="h_name">Guide name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="h_name" name="h_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city">City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="city" name="city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="workage">Working age:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="workage" name="workage" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="fee">Fee:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="fee" name="fee" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="type">Type:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="type" name="type" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="traits">Traits:</label></td>
|
||||
<td style="text-align: left"><textarea id="traits" name="traits" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Guide</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
0
indexes/modify/seller_add/home.css
Normal file
0
indexes/modify/seller_add/home.css
Normal file
89
indexes/modify/seller_add/home.php
Normal file
89
indexes/modify/seller_add/home.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
@keyframes slideShow {
|
||||
0% {background-image: url("../../img/travel2.jpeg");}
|
||||
25% {background-image: url("../../img/travel2.jpeg");}
|
||||
50% {background-image: url("../../img/travel3.jpg");}
|
||||
75% {background-image: url("../../img/travel4.jpg");}
|
||||
100% {background-image: url("../../img/travel2.jpeg");}
|
||||
}
|
||||
#slideshow {
|
||||
width: 80%;
|
||||
height: 600px;
|
||||
background-size: cover;
|
||||
animation: slideShow 10s infinite;
|
||||
border-radius: 15px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
body{
|
||||
background-color:rgb(214,214,214)
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
||||
<div style="font-size: 40px; color: black;text-align: center; font-family: 'Times New Roman', Times, serif;">Please select the type of product you want to add above.</div><br><br>
|
||||
<div id="slideshow"></div>
|
||||
</body>
|
||||
|
||||
<br><br><br><br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
105
indexes/modify/seller_add/stays.php
Normal file
105
indexes/modify/seller_add/stays.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Hotel</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td ><label for="h_name">Hotel name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="h_name" name="h_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city">City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="city" name="city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="roomtype">Room type:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="roomtype" name="roomtype" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="fee">Fee:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="fee" name="fee" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="characteristics">Characteristics:</label></td>
|
||||
<td style="text-align: left"><textarea id="characteristics" name="characteristics" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;"><button type="submit">Add Hotel</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
112
indexes/modify/seller_add/transport.php
Normal file
112
indexes/modify/seller_add/transport.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Transportation</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="h_name">Transportation name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="h_name" name="h_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="t_type">Transportation type:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="t_type" name="t_type" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="s_city">Departure City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="s_city" name="s_city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="e_city">Destination City:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="e_city" name="e_city" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="s_location">Departure Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="s_location" name="s_location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="e_location">Destination Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="e_location" name="e_location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="s_time">Departure time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="s_time" name="s_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="e_time">Destination time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="e_time" name="e_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="ticket">Ticket:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="ticket" name="ticket" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Transportation</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
149
indexes/seller/attractions.php
Normal file
149
indexes/seller/attractions.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<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="../user/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:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any attraction.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the attraction products you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100;; src="data:image/jpeg;base64,'+data[i].attraction_type_image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].aname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].price + 'RMB</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].attraction_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getAttraction.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteAttraction.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
14
indexes/seller/deleteAttraction.php
Normal file
14
indexes/seller/deleteAttraction.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM attraction WHERE attraction_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success','time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
14
indexes/seller/deleteFood.php
Normal file
14
indexes/seller/deleteFood.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM restaurant WHERE restaurant_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success', 'time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
14
indexes/seller/deleteHotel.php
Normal file
14
indexes/seller/deleteHotel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$id = $_POST['restaurantId'];
|
||||
$start=microtime(true);
|
||||
$sql = "DELETE FROM hotel WHERE hotel_id = '$id'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
if ($result) {
|
||||
echo json_encode(['status' => 'success', 'time' => $execution_time]);
|
||||
} else {
|
||||
echo json_encode(['status' => 'error', 'message' => mysqli_error($conn)]);
|
||||
}
|
||||
?>
|
||||
157
indexes/seller/foods.php
Normal file
157
indexes/seller/foods.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<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="../user/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:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
|
||||
</nav>
|
||||
</header>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any restaurant.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the restaurant you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].rname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].fee + 'RMB</td></tr>';
|
||||
html += '<tr><td style="vertical-align:top">Characteristics</td><td style="vertical-align:top">' + data[i].descrip + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].restaurant_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getFood.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteFood.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
58
indexes/seller/getAttraction.php
Normal file
58
indexes/seller/getAttraction.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM attraction WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
// search current page data
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
$sql = "SELECT
|
||||
attraction.attraction_id,
|
||||
attraction.name AS aname,
|
||||
cities.name AS cname,
|
||||
attraction.rating,
|
||||
attraction.descrip,
|
||||
attraction.price,
|
||||
attraction_type.attraction_type_image
|
||||
FROM
|
||||
attraction
|
||||
JOIN
|
||||
cities ON attraction.city_id = cities.id
|
||||
JOIN
|
||||
attraction_type ON attraction.attraction_type_id = attraction_type.attraction_type_id
|
||||
WHERE attraction.seller_id = $seller_id AND attraction.name LIKE '%" . $q . "%'
|
||||
";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["attraction_type_image"] = base64_encode($row["attraction_type_image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
62
indexes/seller/getFood.php
Normal file
62
indexes/seller/getFood.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM restaurant WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
// search current page data
|
||||
$sql = "SELECT
|
||||
restaurant.restaurant_id,
|
||||
restaurant.name AS rname,
|
||||
cities.name AS cname,
|
||||
restaurant.location,
|
||||
restaurant.open_day,
|
||||
restaurant.close_day,
|
||||
restaurant.open_time,
|
||||
restaurant.close_time,
|
||||
restaurant.rating,
|
||||
restaurant_style.restaurant_style_name,
|
||||
restaurant.descrip,
|
||||
restaurant.fee,
|
||||
restaurant_style.restaurant_style_image AS image
|
||||
FROM
|
||||
restaurant
|
||||
JOIN
|
||||
cities ON restaurant.city_id = cities.id
|
||||
JOIN
|
||||
restaurant_style ON restaurant.restaurant_style_id = restaurant_style.restaurant_style_id
|
||||
WHERE restaurant.seller_id = $seller_id AND restaurant.name LIKE '%".$q."%';";
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
51
indexes/seller/getHotel.php
Normal file
51
indexes/seller/getHotel.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
|
||||
$result_count = $conn->query("SELECT COUNT(*) AS count FROM hotel WHERE name LIKE '%$q%'");
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
$sql = "SELECT
|
||||
hotel.hotel_id,
|
||||
hotel.name AS hname,
|
||||
cities.name AS cname,
|
||||
hotel_type.hotel_type_name,
|
||||
hotel.rating,
|
||||
hotel_type.hotel_type_image AS image
|
||||
FROM
|
||||
hotel
|
||||
JOIN
|
||||
cities ON hotel.city_id = cities.id
|
||||
JOIN
|
||||
hotel_type ON hotel.hotel_type_id = hotel_type.hotel_type_id
|
||||
WHERE hotel.seller_id = $seller_id AND hotel.name LIKE '%" . $q . "%'
|
||||
";
|
||||
$result = $conn->query($sql);
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages));
|
||||
?>
|
||||
70
indexes/seller/home.php
Normal file
70
indexes/seller/home.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
|
||||
body{
|
||||
background-color:rgb(214,214,214)
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div style="font-size: 40px; color: black; text-align: center; font-family: 'Times New Roman', Times, serif;">
|
||||
<br><br>Welcome to RoamEase!<br><br>
|
||||
As a business, please operate with integrity and build a harmonious society together.
|
||||
<br><br><br><br>
|
||||
Select the type of product you have on the header.
|
||||
</div><br><br>
|
||||
|
||||
</body>
|
||||
|
||||
<br><br><br><br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
147
indexes/seller/stays.php
Normal file
147
indexes/seller/stays.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<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="../user/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:45%;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller_add/stays.php">Add</a>
|
||||
<a href="../../login/interfaces/profile_seller.php">Account</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
|
||||
</nav>
|
||||
</header>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
myFunction();
|
||||
};
|
||||
</script>
|
||||
<div id="pageContainer" style="display: block; ">
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
function myFunction() {
|
||||
var input = "";
|
||||
var filter = input;
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var data = response.data;
|
||||
totalPages = response.total_pages;
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>You don't have any hotel.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the hotel you have.</div><br><br>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].hname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Type</td><td>' + data[i].hotel_type_name + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="deleteFunction(\'' + data[i].hotel_id + '\')" >Delete</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getHotel.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function deleteFunction(id) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var response = JSON.parse(this.responseText);
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
alert('Successfully delete. Running time: '+time+'s');
|
||||
}
|
||||
};
|
||||
xmlhttp.open("POST", "deleteHotel.php", true);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send("restaurantId=" + id);
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
176
indexes/seller_add/attractions.php
Normal file
176
indexes/seller_add/attractions.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Back To Home</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Attraction</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="attraction_name">Attraction name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="attraction_name" name="attraction_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city_id">City id:</label></td>
|
||||
<td style="text-align: left"><input type="number" min="1" max="151335" id="city_id" name="city_id" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="open_day">Open day:</label></td>
|
||||
<td style="text-align: left"><select id="open_day" name="open_day">
|
||||
<option value="Monday">Monday</option>
|
||||
<option value="Tuesday">Tuesday</option>
|
||||
<option value="Wednesday">Wednesday</option>
|
||||
<option value="Thursday">Thursday</option>
|
||||
<option value="Friday">Friday</option>
|
||||
<option value="Saturday">Saturday</option>
|
||||
<option value="Sunday">Sunday</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="close_day">Close day:</label></td>
|
||||
<td style="text-align: left"><select id="close_day" name="close_day">
|
||||
<option value="Monday">Monday</option>
|
||||
<option value="Tuesday">Tuesday</option>
|
||||
<option value="Wednesday">Wednesday</option>
|
||||
<option value="Thursday">Thursday</option>
|
||||
<option value="Friday">Friday</option>
|
||||
<option value="Saturday">Saturday</option>
|
||||
<option value="Sunday">Sunday</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="open_time">Open time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="open_time" name="open_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="close_time">Close time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="close_time" name="close_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="type">Attracton type:</label></td>
|
||||
<td style="text-align: left"><input type="number" id="type" name="type" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="price">Price(CNY):</label></td>
|
||||
<td style="text-align: left"><input type="number" id="price" name="price" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Attraction</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
//echo "Connected successfully";
|
||||
// Process form submission
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Get form data
|
||||
$attraction_name = $_POST["attraction_name"];
|
||||
$city_id = $_POST["city_id"];
|
||||
$location = $_POST["location"];
|
||||
$open_day = $_POST["open_day"];
|
||||
$close_day = $_POST["close_day"];
|
||||
$open_time = $_POST["open_time"];
|
||||
$close_time = $_POST["close_time"];
|
||||
$type = $_POST["type"];
|
||||
$description = $_POST["description"];
|
||||
$price = $_POST["price"];
|
||||
$seller_id = $_SESSION['uid'];
|
||||
$start=microtime(true);
|
||||
// Insert data into the database
|
||||
$sql = "INSERT INTO attraction ( name, city_id, location, seller_id, open_day, close_day, open_time, close_time, attraction_type_id, descrip, price) VALUES ('$attraction_name', '$city_id', '$location', '$seller_id', '$open_day', '$close_day', '$open_time', '$close_time', '$type', '$description', '$price')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$phpVariable = "Add attraction success. Running time: " . $execution_time . "s";
|
||||
|
||||
|
||||
echo '<script>';
|
||||
echo 'var jsVariable = "' . $phpVariable . '";';
|
||||
echo 'alert(jsVariable);';
|
||||
echo '</script>';
|
||||
} else {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
// close the database
|
||||
$conn->close();
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
175
indexes/seller_add/foods.php
Normal file
175
indexes/seller_add/foods.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Back To Home</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add">
|
||||
<form method="POST" action="">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Restaurant</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="restaurant_name">Restaurant name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="restaurant_name" name="restaurant_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city_id">City id:</label></td>
|
||||
<td style="text-align: left"><input type="number" min="1" max="151335" id="city_id" name="city_id" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="open_day">Open day:</label></td>
|
||||
<td style="text-align: left"><select id="open_day" name="open_day">
|
||||
<option value="Monday">Monday</option>
|
||||
<option value="Tuesday">Tuesday</option>
|
||||
<option value="Wednesday">Wednesday</option>
|
||||
<option value="Thursday">Thursday</option>
|
||||
<option value="Friday">Friday</option>
|
||||
<option value="Saturday">Saturday</option>
|
||||
<option value="Sunday">Sunday</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="close_day">Close day:</label></td>
|
||||
<td style="text-align: left"><select id="close_day" name="close_day">
|
||||
<option value="Monday">Monday</option>
|
||||
<option value="Tuesday">Tuesday</option>
|
||||
<option value="Wednesday">Wednesday</option>
|
||||
<option value="Thursday">Thursday</option>
|
||||
<option value="Friday">Friday</option>
|
||||
<option value="Saturday">Saturday</option>
|
||||
<option value="Sunday">Sunday</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="open_time">Open time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="open_time" name="open_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="close_time">Close time:</label></td>
|
||||
<td style="text-align: left"><input type="time" id="close_time" name="close_time" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="style">Restaurant style:</label></td>
|
||||
<td style="text-align: left"><input type="number" id="style" name="style" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="fee">fee(CNY):</label></td>
|
||||
<td style="text-align: left"><input type="fee" id="fee" name="fee" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit">Add Restaurant</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
//echo "Connected successfully";
|
||||
// Process form submission
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Get form data
|
||||
$restaurant_name = $_POST["restaurant_name"];
|
||||
$city_id = $_POST["city_id"];
|
||||
$location = $_POST["location"];
|
||||
$open_day = $_POST["open_day"];
|
||||
$close_day = $_POST["close_day"];
|
||||
$open_time = $_POST["open_time"];
|
||||
$close_time = $_POST["close_time"];
|
||||
$style = $_POST["style"];
|
||||
$description = $_POST["description"];
|
||||
$fee = $_POST["fee"];
|
||||
$seller_id = $_SESSION['uid'];
|
||||
$start=microtime(true);
|
||||
// Insert data into the database
|
||||
$sql = "INSERT INTO restaurant ( name, city_id, location, seller_id, open_day, close_day, open_time, close_time, restaurant_style_id, descrip, fee) VALUES ('$restaurant_name', '$city_id', '$location', '$seller_id', '$open_day', '$close_day', '$open_time', '$close_time', '$style', '$description', '$fee')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$phpVariable = "Add restaurant success. Running time: ". $execution_time."s";
|
||||
|
||||
|
||||
echo '<script>';
|
||||
echo 'var jsVariable = "' . $phpVariable . '";';
|
||||
echo 'alert(jsVariable);';
|
||||
echo '</script>';
|
||||
} else {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
// close the database
|
||||
$conn->close();
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
0
indexes/seller_add/home.css
Normal file
0
indexes/seller_add/home.css
Normal file
83
indexes/seller_add/home.php
Normal file
83
indexes/seller_add/home.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
@keyframes slideShow {
|
||||
0% {background-image: url("../../img/travel2.jpeg");}
|
||||
25% {background-image: url("../../img/travel2.jpeg");}
|
||||
50% {background-image: url("../../img/travel3.jpg");}
|
||||
75% {background-image: url("../../img/travel4.jpg");}
|
||||
100% {background-image: url("../../img/travel2.jpeg");}
|
||||
}
|
||||
#slideshow {
|
||||
width: 80%;
|
||||
height: 600px;
|
||||
background-size: cover;
|
||||
animation: slideShow 10s infinite;
|
||||
border-radius: 15px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
body{
|
||||
background-color:rgb(214,214,214)
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Home</a>
|
||||
<a href="#">Search</a>
|
||||
<a href="../../login/username.php">Log out</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="./stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
||||
<div style="font-size: 40px; color: black;text-align: center; font-family: 'Times New Roman', Times, serif;">Please select the type of product you want to add above.</div><br><br>
|
||||
<div id="slideshow"></div>
|
||||
</body>
|
||||
|
||||
<br><br><br><br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
282
indexes/seller_add/stays.php
Normal file
282
indexes/seller_add/stays.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['usertype']) || $_SESSION['usertype'] !== "seller") {
|
||||
header('Location: ../../index.php');
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<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="../user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
td{padding:3px;}
|
||||
table{background-color:rgb(255, 255, 255,0.5);}
|
||||
#div_ground {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:rgb(225, 240, 255);
|
||||
}
|
||||
#div_add {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chiose-button {
|
||||
width: 200px;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
background-color: #003b94;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// Show div1 by default
|
||||
showTable('div1');
|
||||
|
||||
function showTable(tableId) {
|
||||
// Hide all tables
|
||||
document.getElementById('div1').classList.add('hidden');
|
||||
document.getElementById('div2').classList.add('hidden');
|
||||
|
||||
// Show the selected table
|
||||
document.getElementById(tableId).classList.remove('hidden');
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="../seller/home.php">Back To Home</a>
|
||||
</div>
|
||||
</header>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="stays.php">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</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>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="div_ground"></div>
|
||||
<div id="div_add" style="text-align: center;">
|
||||
|
||||
<button class="chiose-button" onclick="showTable('div1')">Add Hotel</button>
|
||||
<button class="chiose-button" onclick="showTable('div2')">Add Room</button>
|
||||
|
||||
<div id="div1">
|
||||
<form id="formA" action="" method="post">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add Hotel</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td ><label for="hotel_name">Hotel name:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="hotel_name" name="hotel_name" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="city_id">City id:</label></td>
|
||||
<td style="text-align: left"><input type="number" id="city_id" name="city_id" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="location">Location:</label></td>
|
||||
<td style="text-align: left"><input type="text" id="location" name="location" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="hotel_type_id">Hotel type id:</label></td>
|
||||
<td style="text-align: left"><select id="hotel_type_id" name="hotel_type_id">
|
||||
<option value="1">Boutique Hotel</option>
|
||||
<option value="2">Chain Hotel</option>
|
||||
<option value="3">Resort</option>
|
||||
<option value="4">Business Hotel</option>
|
||||
<option value="5">Budget Hotel</option>
|
||||
<option value="6">Luxury Hotel</option>
|
||||
<option value="7">Bed and Breakfast (B&B)</option>
|
||||
<option value="8">Extended Stay Hotel</option>
|
||||
<option value="9">Airport Hotel</option>
|
||||
<option value="10">Hostel</option>
|
||||
<option value="11">Motel</option>
|
||||
<option value="12">Themed Hotel</option>
|
||||
<option value="13">Historic Hotel</option>
|
||||
<option value="14">Spa Hotel</option>
|
||||
<option value="15">Vacation Rental</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="description">Description:</label></td>
|
||||
<td style="text-align: left"><textarea id="description" name="description" required></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;"><button type="submit" name="submit_form1" >Add Hotel</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="div2" class="hidden">
|
||||
<form id="formB" action="" method="post">
|
||||
<table style="text-align: right;border:black '1';width: 100%;height: 100%;" align="center">
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: center;font-size: 30px;"><b>Add room</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="hotel_id">Hotel name:</label></td>
|
||||
<td style="text-align: left">
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
$seller_id = $_SESSION['uid'];
|
||||
|
||||
|
||||
$sql = "SELECT hotel_id, name FROM hotel WHERE seller_id = $seller_id";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if($sql=="null"){
|
||||
echo 'You do not have any hotel';
|
||||
}else{
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo '<input type="checkbox" name="hotel_id" value="' . $row['hotel_id'] . '">' . $row['name'] . '<br>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="room_type_id">Room type:</label></td>
|
||||
<td style="text-align: left"><select id="room_type_id" name="room_type_id">
|
||||
<option value="1">Standard Room</option>
|
||||
<option value="2">Deluxe Room</option>
|
||||
<option value="3">Double Room</option>
|
||||
<option value="4">Queen Room</option>
|
||||
<option value="5">Suite</option>
|
||||
<option value="6">Executive Suite</option>
|
||||
<option value="7">Family Room</option>
|
||||
<option value="8">Accessible Room</option>
|
||||
<option value="9">Honeymoon Suite</option>
|
||||
<option value="10">Spa Room</option>
|
||||
<option value="11">Loft</option>
|
||||
<option value="12">Ocean View Room</option>
|
||||
<option value="13">City View Room</option>
|
||||
<option value="14">Villa</option>
|
||||
<option value="15">Presidential Suite</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="price">Price:</label></td>
|
||||
<td style="text-align: left"><input type="number" id="price" name="price" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="quantity">Quantity:</label></td>
|
||||
<td style="text-align: left"><input type="number" id="quantity" name="quantity" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center"><button type="submit" name="submit_form2" >Add room</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit_form1'])) {
|
||||
// Process data from Table A
|
||||
$hotel_name = $_POST["hotel_name"];
|
||||
$city_id = $_POST["city_id"];
|
||||
$location = $_POST["location"];
|
||||
$hotel_type_id = $_POST["hotel_type_id"];
|
||||
$seller_id = $_SESSION['uid'];
|
||||
$description = $_POST["description"];
|
||||
$start=microtime(true);
|
||||
// Insert data into the database
|
||||
$sql1 = "INSERT INTO hotel ( name, city_id, location, hotel_type_id, seller_id, descrip) VALUES ('$hotel_name', '$city_id', '$location','$hotel_type_id', '$seller_id', '$description')";
|
||||
|
||||
if ($conn->query($sql1) === TRUE) {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$phpVariable = "Add hotel success. Running time: ".$execution_time."s";
|
||||
|
||||
|
||||
echo '<script>';
|
||||
echo 'var jsVariable = "' . $phpVariable . '";';
|
||||
echo 'alert(jsVariable);';
|
||||
echo '</script>';
|
||||
} else {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
echo "Error: " . $sql1 . "<br>" . $conn->error;
|
||||
}
|
||||
|
||||
}
|
||||
if (isset($_POST['submit_form2'])) {
|
||||
// Process data from Table B
|
||||
$hotel_id = $_POST["hotel_id"];
|
||||
$room_type_id = $_POST["room_type_id"];
|
||||
$price = $_POST["price"];
|
||||
$quantity = $_POST["quantity"];
|
||||
$start=microtime(true);
|
||||
// Insert data into the database
|
||||
$sql2 = "INSERT INTO hotel_room (hotel_id, room_type_id, price, quantity) VALUES ('$hotel_id', '$room_type_id', '$price', '$quantity')";
|
||||
|
||||
if ($conn->query($sql2) === TRUE) {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$phpVariable = "Add room success. Running time: ".$execution_time."s";
|
||||
|
||||
|
||||
echo '<script>';
|
||||
echo 'var jsVariable = "' . $phpVariable . '";';
|
||||
echo 'alert(jsVariable);';
|
||||
echo '</script>';
|
||||
} else {
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
echo "Error: " . $sql2 . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
125
indexes/user/addcart.php
Normal file
125
indexes/user/addcart.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
}
|
||||
else {
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../../login/username.php?error=You need to login to process this action!';
|
||||
</script>";
|
||||
}
|
||||
|
||||
if (isset($_GET["target_id"]) && isset($_GET["start_date"]) && isset($_GET["end_date"]) && isset($_GET["quantity"]) && isset($_GET["table"])) {
|
||||
$target_id = $_GET["target_id"];
|
||||
$start_date = $_GET["start_date"];
|
||||
$end_date = $_GET["end_date"];
|
||||
|
||||
if ($end_date && $end_date !== 'NULL'){
|
||||
// Convert the dates to DateTime objects
|
||||
$start = new DateTime($start_date);
|
||||
$end = new DateTime($end_date);
|
||||
// Calculate the difference
|
||||
$interval = $start->diff($end);
|
||||
$days = $interval->days;
|
||||
}
|
||||
|
||||
$quantity = intval($_GET["quantity"]);
|
||||
|
||||
$new_booking_query = "INSERT INTO `bookings` (`booking_id`) VALUES (NULL)";
|
||||
$new_booking_set = mysqli_query($conn, $new_booking_query);
|
||||
$booking_id = mysqli_insert_id($conn);
|
||||
|
||||
switch ($_GET["table"]) {
|
||||
case '1':
|
||||
$price_query = "SELECT price FROM hotel_room WHERE hotel_room_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["price"];
|
||||
$subtotal_price = $price * $days;
|
||||
|
||||
$query = "INSERT INTO `hotel_booking` (`booking_id`, `hotel_room_id`, `start_date`, `end_date`, `quantity`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$end_date', '$quantity', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '1', '$subtotal_price', '1')";
|
||||
break;
|
||||
case '2':
|
||||
$price_query = "SELECT fee FROM restaurant WHERE restaurant_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["fee"];
|
||||
$subtotal_price = $price;
|
||||
|
||||
$query = "INSERT INTO `restaurant_booking` (`booking_id`, `restaurant_id`, `visit_date`, `quantity`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$quantity', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '2', '$subtotal_price', '1')";
|
||||
break;
|
||||
case '3':
|
||||
$price_query = "SELECT price FROM attraction WHERE attraction_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["price"];
|
||||
$subtotal_price = $price;
|
||||
|
||||
$query = "INSERT INTO `attraction_booking` (`booking_id`, `attraction_id`, `visit_date`, `quantity`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$quantity', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '3', '$subtotal_price', '1')";
|
||||
break;
|
||||
case '4':
|
||||
$price_query = "SELECT fee FROM user_guide WHERE u_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["fee"];
|
||||
$subtotal_price = $price * $days;
|
||||
|
||||
$query = "INSERT INTO `guide_booking` (`booking_id`, `guide_id`, `start_date`, `end_date`, `quantity`, `guide_availability`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$end_date', '$quantity', '0', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '4', '$subtotal_price', '1')";
|
||||
break;
|
||||
case '5':
|
||||
$price_query = "SELECT fee FROM transport_flight_class WHERE flight_class_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["fee"];
|
||||
$subtotal_price = $price;
|
||||
|
||||
$query = "INSERT INTO `transport_flight_booking` (`booking_id`, `flight_class_id`, `visit_date`, `quantity`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$quantity', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '5', '$subtotal_price', '1')";
|
||||
break;
|
||||
case '6':
|
||||
$price_query = "SELECT fee FROM transport_railway_class WHERE train_seat_id=" . $target_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["fee"];
|
||||
$subtotal_price = $price;
|
||||
|
||||
$query = "INSERT INTO `transport_railway_booking` (`booking_id`, `railway_class_id`, `visit_date`, `quantity`, `payment_status`) VALUES ('$booking_id', '$target_id', '$start_date', '$quantity', '0')";
|
||||
$cart = "INSERT INTO `cart_bookings` (`u_id`, `booking_id`, `booking_type_id`, `subtotal_price`, `choose`) VALUES ('$uid', '$booking_id', '6', '$subtotal_price', '1')";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
break;
|
||||
}
|
||||
|
||||
$firstQueryResult = mysqli_query($conn, $query);
|
||||
if ($firstQueryResult) {
|
||||
$cartQueryResult = mysqli_query($conn, $cart);
|
||||
if (!$cartQueryResult) {
|
||||
// Log error or display a more specific message
|
||||
$errorMsg = mysqli_error($conn);
|
||||
echo "<p>Error occurred while executing cart query: $errorMsg</p>";
|
||||
}
|
||||
} else {
|
||||
// Log error or display a more specific message
|
||||
$errorMsg = mysqli_error($conn);
|
||||
echo "<p>Error occurred while executing the first query: $errorMsg</p>";
|
||||
}
|
||||
|
||||
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price + ('$subtotal_price' * '$quantity') WHERE u_id='$uid'";
|
||||
$res = mysqli_query($conn, $total);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: ./process/cart.php');
|
||||
?>
|
||||
289
indexes/user/attractions.php
Normal file
289
indexes/user/attractions.php
Normal file
@@ -0,0 +1,289 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Ticket@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>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:5%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
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;
|
||||
}
|
||||
</STYLE>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<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="home.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a><input class="searchBox" type="text" id="myInput" placeholder="search attraction"></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">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="foods.php">
|
||||
<img src="../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#" style="border-color: white;">
|
||||
<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>
|
||||
|
||||
<div id="pageContainer" style="display: block;">
|
||||
<div style="color:blue;font-size:40px;text-align:center; margin-top:1%; font-family:'Apple Chancery', cursive;"><i>RECOMMEND</i></div>
|
||||
<div>
|
||||
<div class="hotel" style="cursor:default; text-align:center; color:white; background-image:url(../../img/attraction/4.jpg); " >
|
||||
<p style="margin-top:40%;">Emerald Gardens
|
||||
</div><br>
|
||||
<div class="hotel" style="cursor:default; text-align:center; color:white; background-image:url(../../img/attraction/6.jpg);">
|
||||
<p style="margin-top:40%;">Royal History Museum
|
||||
</div>
|
||||
</div><br><br>
|
||||
<div style="text-align:center;"><button class="pagebutton" onclick="myFunction()" style="font-size:20px; width:40%;font-family: Times New Roman, Times, serif; color:red; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); cursor:pointer;">Click here to get the full list of restaurant</button></div>
|
||||
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
function changePage(pageNumber) {
|
||||
currentPage = pageNumber;
|
||||
myFunction();
|
||||
}
|
||||
|
||||
function myFunction() {
|
||||
var input = document.getElementById('myInput');
|
||||
var filter = 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;
|
||||
totalPages = response.total_pages;
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
var html = '';
|
||||
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>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the attraction 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="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;" onclick="window.open(\'./getInfo/AtInfo.php?id=' + data[i].attraction_id + '\', \'_blank\');">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100;; src="data:image/jpeg;base64,'+data[i].attraction_type_image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].aname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].price + 'RMB</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="addToPlan(\'' + data[i].attraction_id + '\')" >ADD</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
generatePageButtons();
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getAttraction.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function addToPlan(attractionId) {
|
||||
var startDate = prompt("Select visit_date:", formatDate(new Date()));
|
||||
if (startDate) {
|
||||
var url = `./plans_do.php?attraction_id=${attractionId}&visit_date=${startDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
function generatePageButtons() {
|
||||
var html = '';
|
||||
var startPage = Math.max(currentPage - 2, 1);
|
||||
var endPage = Math.min(currentPage + 2, totalPages);
|
||||
var html2='';
|
||||
|
||||
|
||||
// Always add the first page button
|
||||
if ((currentPage != 1||currentPage != 2||currentPage == 3)&&endPage!=0) {
|
||||
html += '<button class="pagebutton" onclick="changePage(1)">1</button>';
|
||||
}
|
||||
|
||||
// Add "..." before current pages
|
||||
if (startPage > 2&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Add buttons for current pages
|
||||
for (var i = startPage+1; i <= endPage; i++) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + i + ')">' + i + '</button>';
|
||||
}
|
||||
|
||||
// Add "..." after current pages
|
||||
if (endPage < totalPages - 1&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
// Always add the last page button
|
||||
if (currentPage != totalPages && totalPages != 2&& totalPages != 3&& totalPages != 4&& totalPages != 5) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + totalPages + ')">' + totalPages + '</button>';
|
||||
}
|
||||
document.getElementById("pageButtons").innerHTML = html;
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
199
indexes/user/flight.php
Normal file
199
indexes/user/flight.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<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>
|
||||
295
indexes/user/foods.php
Normal file
295
indexes/user/foods.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Taste@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>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:5%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:45%;
|
||||
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;
|
||||
}
|
||||
</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="myInput" placeholder="search restaurant"></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">
|
||||
<img src="../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#" style="border-color: white;">
|
||||
<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>
|
||||
|
||||
<div id="pageContainer" style="display: block;">
|
||||
<div style="color:blue;font-size:40px;text-align:center; margin-top:1%; font-family:'Apple Chancery', cursive;"><i>RECOMMEND</i></div>
|
||||
<div>
|
||||
<div class="hotel" style="text-align:center; cursor:default; color:white; background-image:url(../../img/restaurant/2.jpg); " >
|
||||
<p style="margin-top:40%;">Vargas Ltd Bakery
|
||||
</div><br>
|
||||
<div class="hotel" style="text-align:center; cursor:default; color:white; background-image:url(../../img/restaurant/4.jpg);">
|
||||
<p style="margin-top:40%;">Gomez-Baker Joint
|
||||
</div>
|
||||
</div><br><br>
|
||||
<div style="text-align:center;"><button class="pagebutton" onclick="myFunction()" style="font-size:20px; width:40%;font-family: Times New Roman, Times, serif; color:red; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); cursor:pointer;">Click here to get the full list of restaurant</button></div>
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
function changePage(pageNumber) {
|
||||
currentPage = pageNumber;
|
||||
myFunction();
|
||||
}
|
||||
|
||||
function myFunction() {
|
||||
var input = document.getElementById('myInput');
|
||||
var filter = 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;
|
||||
totalPages = response.total_pages;
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
var html = '';
|
||||
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>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the restaurant 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="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;" onclick="window.open(\'./getInfo/FoInfo.php?id=' + data[i].restaurant_id + '\', \'_blank\');">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].rname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Ticket</td><td>' + data[i].fee + 'RMB</td></tr>';
|
||||
html += '<tr><td style="vertical-align:top">Characteristics</td><td style="vertical-align:top">' + data[i].descrip + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="addToPlan(\'' + data[i].restaurant_id + '\')" >ADD</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
generatePageButtons();
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getFood.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
|
||||
function addToPlan(restaurantId) {
|
||||
var startDate = prompt("Select visit_date:", formatDate(new Date()));
|
||||
if (startDate) {
|
||||
var url = `./plans_do.php?restaurant_id=${restaurantId}&visit_date=${startDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
function generatePageButtons() {
|
||||
var html = '';
|
||||
var startPage = Math.max(currentPage - 2, 1);
|
||||
var endPage = Math.min(currentPage + 2, totalPages);
|
||||
var html2='';
|
||||
|
||||
|
||||
// Always add the first page button
|
||||
if ((currentPage != 1||currentPage != 2||currentPage == 3)&&endPage!=0) {
|
||||
html += '<button class="pagebutton" onclick="changePage(1)">1</button>';
|
||||
}
|
||||
|
||||
// Add "..." before current pages
|
||||
if (startPage > 2&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Add buttons for current pages
|
||||
for (var i = startPage+1; i <= endPage; i++) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + i + ')">' + i + '</button>';
|
||||
}
|
||||
|
||||
// Add "..." after current pages
|
||||
if (endPage < totalPages - 1&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Always add the last page button
|
||||
if (currentPage != totalPages && totalPages != 2&& totalPages != 3&& totalPages != 4&& totalPages != 5) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + totalPages + ')">' + totalPages + '</button>';
|
||||
}
|
||||
|
||||
document.getElementById("pageButtons").innerHTML = html;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
52
indexes/user/getAttraction.php
Normal file
52
indexes/user/getAttraction.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM attraction WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
// search current page data
|
||||
$start=microtime(true);
|
||||
$sql = "SELECT
|
||||
attraction.attraction_id,
|
||||
attraction.name AS aname,
|
||||
cities.name AS cname,
|
||||
attraction.rating,
|
||||
attraction.descrip,
|
||||
attraction.price,
|
||||
attraction_type.attraction_type_image
|
||||
FROM
|
||||
attraction
|
||||
JOIN
|
||||
cities ON attraction.city_id = cities.id
|
||||
JOIN
|
||||
attraction_type ON attraction.attraction_type_id = attraction_type.attraction_type_id
|
||||
WHERE attraction.name LIKE '%".$q."%' LIMIT $limit OFFSET $offset";
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["attraction_type_image"] = base64_encode($row["attraction_type_image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages,"time"=>$execution_time));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
27
indexes/user/getCities.php
Normal file
27
indexes/user/getCities.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// Include your database connection script
|
||||
include '../connectDB.php';
|
||||
|
||||
// Get the state_id from the query string
|
||||
$stateId = isset($_GET['state_id']) ? intval($_GET['state_id']) : 0;
|
||||
|
||||
// Array to hold cities
|
||||
$cities = [];
|
||||
|
||||
// Fetch cities from the database based on state_id
|
||||
if ($stateId > 0) {
|
||||
$query = "SELECT `id`, `name` FROM cities WHERE state_id = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("i", $stateId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$cities[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the cities as JSON
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($cities);
|
||||
?>
|
||||
45
indexes/user/getFlight.php
Normal file
45
indexes/user/getFlight.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
$destinationCity = $_REQUEST["destinationCity"];
|
||||
$departureCity = $_REQUEST["departureCity"];
|
||||
|
||||
|
||||
$start=microtime(true);
|
||||
$sql = "SELECT
|
||||
transport_flight.flight_id,
|
||||
transport_flight.flight_code,
|
||||
departure_city.name AS from_name,
|
||||
arrival_city.name AS dest_name,
|
||||
transport_airline.name AS air_name
|
||||
FROM
|
||||
transport_flight
|
||||
JOIN
|
||||
transport_airport AS departure_airport ON transport_flight.from_airport_id = departure_airport.airport_id
|
||||
JOIN
|
||||
transport_airport AS arrival_airport ON transport_flight.dest_airport_id = arrival_airport.airport_id
|
||||
JOIN
|
||||
transport_airline ON transport_flight.airline_id = transport_airline.airline_id
|
||||
JOIN
|
||||
cities AS departure_city ON departure_airport.city_id = departure_city.id
|
||||
JOIN
|
||||
cities AS arrival_city ON arrival_airport.city_id = arrival_city.id
|
||||
WHERE arrival_city.name LIKE '%".$destinationCity."%' AND departure_city.id='".$departureCity."'";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data,"time"=>$execution_time));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
57
indexes/user/getFood.php
Normal file
57
indexes/user/getFood.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM restaurant WHERE name LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
$start=microtime(true);
|
||||
// search current page data
|
||||
$sql = "SELECT
|
||||
restaurant.restaurant_id,
|
||||
restaurant.name AS rname,
|
||||
cities.name AS cname,
|
||||
restaurant.location,
|
||||
restaurant.open_day,
|
||||
restaurant.close_day,
|
||||
restaurant.open_time,
|
||||
restaurant.close_time,
|
||||
restaurant.rating,
|
||||
restaurant_style.restaurant_style_name,
|
||||
restaurant.descrip,
|
||||
restaurant.fee,
|
||||
restaurant_style.restaurant_style_image AS image
|
||||
FROM
|
||||
restaurant
|
||||
JOIN
|
||||
cities ON restaurant.city_id = cities.id
|
||||
JOIN
|
||||
restaurant_style ON restaurant.restaurant_style_id = restaurant_style.restaurant_style_id
|
||||
WHERE restaurant.name LIKE '%".$q."%' LIMIT $limit OFFSET $offset;";
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages,"time"=>$execution_time));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
46
indexes/user/getGuide.php
Normal file
46
indexes/user/getGuide.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["q"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// find the total corresponding message
|
||||
$sql_count = "SELECT COUNT(*) AS count FROM user_guide WHERE username LIKE '%".$q."%'";
|
||||
$result_count = $conn->query($sql_count);
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
// calculate the total page number
|
||||
$total_pages = ceil($count / $limit);
|
||||
$start=microtime(true);
|
||||
// search current page data
|
||||
$sql = "SELECT
|
||||
user_guide.u_id,
|
||||
user_guide.username,
|
||||
guide_type.guide_type_name AS typename,
|
||||
user_guide.rating,
|
||||
user_guide.fee,
|
||||
user_guide.descrip
|
||||
FROM
|
||||
user_guide JOIN guide_type ON user_guide.guide_type_id=guide_type.guide_type_id
|
||||
WHERE username LIKE '%".$q."%' LIMIT $limit OFFSET $offset";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages,"time"=>$execution_time));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
54
indexes/user/getHotel.php
Normal file
54
indexes/user/getHotel.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$q = $_REQUEST["myinput"];
|
||||
$state = $_REQUEST["state"];
|
||||
$city = $_REQUEST["city"];
|
||||
$hotel_type = $_REQUEST["hotel_type"];
|
||||
$page = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
|
||||
$limit = 3;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$result_count = $conn->query("SELECT COUNT(*) AS count FROM hotel JOIN
|
||||
cities ON hotel.city_id = cities.id
|
||||
JOIN states ON cities.state_id=states.id
|
||||
JOIN
|
||||
hotel_type ON hotel.hotel_type_id = hotel_type.hotel_type_id
|
||||
WHERE hotel.name LIKE '%$q%' AND states.id=$state AND cities.id=$city AND hotel_type.hotel_type_id=$hotel_type");
|
||||
$row_count = $result_count->fetch_assoc();
|
||||
$count = $row_count["count"];
|
||||
|
||||
|
||||
$total_pages = ceil($count / $limit);
|
||||
|
||||
$start=microtime(true);
|
||||
$sql = "SELECT hotel.hotel_id,
|
||||
hotel.name AS hname,
|
||||
cities.name AS cname,
|
||||
hotel_type.hotel_type_name,
|
||||
hotel.rating,
|
||||
hotel_type.hotel_type_image AS image
|
||||
FROM
|
||||
hotel
|
||||
JOIN
|
||||
cities ON hotel.city_id = cities.id
|
||||
JOIN states ON cities.state_id=states.id
|
||||
JOIN
|
||||
hotel_type ON hotel.hotel_type_id = hotel_type.hotel_type_id
|
||||
WHERE hotel.name LIKE '%$q%' AND states.id=$state AND cities.id=$city AND hotel_type.hotel_type_id=$hotel_type
|
||||
LIMIT $limit OFFSET $offset";
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
|
||||
echo json_encode(array("data" => $data, "total_pages" => $total_pages,"time"=>$execution_time));
|
||||
?>
|
||||
136
indexes/user/getInfo/AtInfo.php
Normal file
136
indexes/user/getInfo/AtInfo.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:15%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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">
|
||||
<img src="../../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="../foods.php">
|
||||
<img src="../../../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="../attraction.php" style="border-color: white;">
|
||||
<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>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var attractionDetail; // Declare globally
|
||||
var aid; // Declare globally
|
||||
|
||||
function GoodFunction(){
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
|
||||
detailHtml += '<tr><td rowspan="11"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].attraction_type_image+'" alt="Hotel Image"></td>';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].name + '</td></tr>';
|
||||
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
|
||||
detailHtml += '<tr><td>Open Time</td><td>' + attractionDetail[0].open_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Close Time</td><td>' + attractionDetail[0].close_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Open Day</td><td>' + attractionDetail[0].open_day + '</td></tr>';
|
||||
detailHtml += '<tr><td>Close Day</td><td>' + attractionDetail[0].close_day + '</td></tr>';
|
||||
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].attraction_type_name + '</td></tr>';
|
||||
detailHtml += '<tr><td>Ticket</td><td>' + attractionDetail[0].price + 'RMB</td></tr>';
|
||||
detailHtml += '<tr><td>  </td><td></td> </tr>';
|
||||
detailHtml += '<tr><td style="vertical-align:top">Introduction</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
|
||||
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
|
||||
detailHtml += '</table>';
|
||||
detailHtml +='<a href="../attractions.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
xmlhttp.open("GET", "getAtInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
let price = attractionDetail[0].price; // Now accessible
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=3&price=' + price;
|
||||
}
|
||||
|
||||
GoodFunction();
|
||||
</script>
|
||||
|
||||
<div id="detail"></div><br><br><br>
|
||||
|
||||
<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>
|
||||
171
indexes/user/getInfo/FlInfo.php
Normal file
171
indexes/user/getInfo/FlInfo.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:10%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var aid;
|
||||
var attractionDetail;
|
||||
|
||||
function GoodFunction(){
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].flight_code + '</td></tr>';
|
||||
detailHtml += '<tr><td>Departure</td><td>' + attractionDetail[0].from_name +'<td>Airport: '+attractionDetail[0].departure_airport_name+'</td></td></tr>';
|
||||
detailHtml += '<tr><td>Destination</td><td>' + attractionDetail[0].dest_name + '<td>Airport: '+attractionDetail[0].arrival_airport_name+'</td></tr>';
|
||||
detailHtml += '<tr><td>Week routine</td><td>' + attractionDetail[0].week_routine + '</td></tr>';
|
||||
detailHtml += '<tr><td>Take off time</td><td>' + attractionDetail[0].takeoff_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Landing time</td><td>' + attractionDetail[0].landing_time + '</td></tr>';
|
||||
for (var i = 0; i < attractionDetail.length; i++) {
|
||||
detailHtml += '<tr>';
|
||||
detailHtml += '<td><input type="radio" id="flight_class_id" name="flight_class_id" value="' + attractionDetail[i].flight_class_id + '">';
|
||||
detailHtml += attractionDetail[i].class + '</td>';
|
||||
detailHtml += '<td>' + attractionDetail[i].fee + 'RMB</td>';
|
||||
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].flight_class_id + ')">Add to Plan</div></td>';
|
||||
if (i==0){
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
}
|
||||
detailHtml += '</tr>';
|
||||
}
|
||||
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
|
||||
detailHtml += '</table>';
|
||||
detailHtml +='<a href="../flight.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
xmlhttp.open("GET", "getFlInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
let price = attractionDetail[0].price; // Now accessible
|
||||
let product_id = document.getElementById("flight_class_id").value;
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=5&price=' + price;
|
||||
}
|
||||
|
||||
GoodFunction();
|
||||
|
||||
function addToPlan(flightClassId) {
|
||||
var startDate = prompt("Select visit_date:", formatDate(new Date()));
|
||||
if (startDate) {
|
||||
var url = `../plans_do.php?flightClassId=${flightClassId}&visit_date=${startDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
</script>
|
||||
<div id="detail"></div><br><br><br>
|
||||
<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>
|
||||
131
indexes/user/getInfo/FoInfo.php
Normal file
131
indexes/user/getInfo/FoInfo.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:15%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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">
|
||||
<img src="../../../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="../foods.php" style="border-color: white;">
|
||||
<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>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var attractionDetail; // Declare globally
|
||||
var aid; // Declare globally
|
||||
|
||||
function GoodFunction(){
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
|
||||
detailHtml += '<tr><td rowspan="11"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].image+'" alt="Hotel Image"></td>';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].rname + '</td></tr>';
|
||||
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
|
||||
detailHtml += '<tr><td>Open Time</td><td>' + attractionDetail[0].open_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Close Time</td><td>' + attractionDetail[0].close_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Open Day</td><td>' + attractionDetail[0].open_day + '</td></tr>';
|
||||
detailHtml += '<tr><td>Close Day</td><td>' + attractionDetail[0].close_day + '</td></tr>';
|
||||
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].restaurant_style_name + '</td></tr>';
|
||||
detailHtml += '<tr><td>Fee</td><td>' + attractionDetail[0].fee + 'RMB</td></tr>';
|
||||
detailHtml += '<tr><td>  </td><td></td> </tr>';
|
||||
detailHtml += '<tr><td style="vertical-align:top">Description</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
|
||||
detailHtml += '</table>';
|
||||
detailHtml +='<a href="../foods.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
xmlhttp.open("GET", "getFoInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=2';
|
||||
}
|
||||
|
||||
GoodFunction();
|
||||
</script>
|
||||
<div id="detail"></div><br><br><br>
|
||||
<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>
|
||||
130
indexes/user/getInfo/GuInfo.php
Normal file
130
indexes/user/getInfo/GuInfo.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:15%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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">
|
||||
<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" style="border-color: white;">
|
||||
<img src="../../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
<a href="../plans.php">
|
||||
<img src="../../../icon/header/plans.svg" alt="Plans">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var attractionDetail; // Declare globally
|
||||
var aid; // Declare globally
|
||||
|
||||
function GoodFunction(){
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-1.1%;">';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].username + '</td></tr>';
|
||||
detailHtml += '<tr><td>Working age</td><td>' + attractionDetail[0].working_age + '</td></tr>';
|
||||
detailHtml += '<tr><td>Type</td><td>' + attractionDetail[0].guide_type_name + '</td></tr>';
|
||||
detailHtml += '<tr><td>Fee</td><td>' + attractionDetail[0].fee+ 'RMB</td></tr>';
|
||||
detailHtml += '<tr><td>  </td><td></td> </tr>';
|
||||
detailHtml += '<tr><td style="vertical-align:top">Description</td><td style="vertical-align:top">' + attractionDetail[0].descrip + '</td></tr>';
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field with button"><input type="date" id="end_date" class="edit-button" name="end_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="end_date">End date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
|
||||
detailHtml += '</table>';
|
||||
detailHtml +='<a href="../guiding.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
detailHtml +='<a href="../guiding.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
xmlhttp.open("GET", "getGuInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let end_date = document.getElementById("end_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
let price = attractionDetail[0].price; // Now accessible
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + aid + '&start_date=' + start_date + '&end_date=' + end_date + '&quantity=' + quantity + '&table=4&price=' + price;
|
||||
}
|
||||
|
||||
GoodFunction();
|
||||
</script>
|
||||
<div id="detail"></div><br><br><br>
|
||||
<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>
|
||||
179
indexes/user/getInfo/HoInfo.php
Normal file
179
indexes/user/getInfo/HoInfo.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:10%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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" style="border-color: white;">
|
||||
<img src="../../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="../transport.php">
|
||||
<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>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var attractionDetail; // Declare globally
|
||||
var aid; // Declare globally
|
||||
|
||||
function GoodFunction() {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
|
||||
detailHtml += '<tr><td rowspan="20"><img width=130; height=100; src="data:image/jpeg;base64,'+attractionDetail[0].image+'" alt="Hotel Image"></td>';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].hname + '</td></tr>';
|
||||
detailHtml += '<tr><td>Location</td><td>' + attractionDetail[0].location + '</td></tr>';
|
||||
detailHtml += '<tr><td style="vertical-align:top;">Description</td><td style="vertical-align:top;">' + attractionDetail[0].descrip + '</td></tr>';
|
||||
for (var i = 0; i < attractionDetail.length; i++) {
|
||||
detailHtml += '<tr>';
|
||||
detailHtml += '<td><input type="radio" id="hotel_room_id" name="hotel_room_id" value="' + attractionDetail[i].hotel_room_id + '">';
|
||||
detailHtml += attractionDetail[i].rType + '</td>';
|
||||
detailHtml += '<td>' + attractionDetail[i].price + 'RMB</td>';
|
||||
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].hotel_room_id + ')">Add to Plan</div></td>';
|
||||
if (i==0){
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
}
|
||||
detailHtml += '</tr>';
|
||||
}
|
||||
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field with button"><input type="date" id="end_date" class="edit-button" name="end_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="end_date">End date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
|
||||
|
||||
detailHtml += '</table><a href="../stays.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
detailHtml += '';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
|
||||
xmlhttp.open("GET", "getHoInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let end_date = document.getElementById("end_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
let price = attractionDetail[0].price; // Now accessible
|
||||
let product_id = document.getElementById("hotel_room_id").value;
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=' + end_date + '&quantity=' + quantity + '&table=1&price=' + price;
|
||||
}
|
||||
|
||||
}
|
||||
GoodFunction();
|
||||
</script>
|
||||
|
||||
<div id="detail"></div><br><br><br>
|
||||
<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>
|
||||
|
||||
<script>
|
||||
function addToPlan(roomId) {
|
||||
var startDate = prompt("Select start date:", formatDate(new Date()));
|
||||
var endDate = prompt("Select end date:", formatDate(new Date()));
|
||||
if (startDate && endDate) {
|
||||
var url = `../plans_do.php?roomId=${roomId}&startDate=${startDate}&endDate=${endDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
172
indexes/user/getInfo/RaInfo.php
Normal file
172
indexes/user/getInfo/RaInfo.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<html>
|
||||
<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">
|
||||
<header>
|
||||
<style>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:10%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
<div class="logo">
|
||||
<a href="../home.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
session_start();
|
||||
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">
|
||||
<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" style="border-color: white;">
|
||||
<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>
|
||||
|
||||
<style>
|
||||
table tr td:first-child {
|
||||
width: 160px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var attractionDetail; // Declare globally
|
||||
var aid; // Declare globally
|
||||
|
||||
function GoodFunction(){
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
aid = urlParams.get('id');
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
attractionDetail = JSON.parse(this.responseText);
|
||||
console.log(attractionDetail);
|
||||
var detailHtml = '<table style="border-collapse: collapse; width:100%; height:70%; margin-top:-0.1%;">';
|
||||
detailHtml += '<tr><td>Name</td><td>' + attractionDetail[0].train_code + '</td></tr>';
|
||||
detailHtml += '<tr><td>Departure</td><td>' + attractionDetail[0].from_name +'<td>Station: ' +attractionDetail[0].departure_station_name+'</td></tr>';
|
||||
detailHtml += '<tr><td>Destination</td><td>' + attractionDetail[0].dest_name +'<td>Station: ' +attractionDetail[0].arrival_station_name+'</td></tr>';
|
||||
detailHtml += '<tr><td>Week routine</td><td>' + attractionDetail[0].week_routine + '</td></tr>';
|
||||
detailHtml += '<tr><td>Strat time</td><td>' + attractionDetail[0].start_time + '</td></tr>';
|
||||
detailHtml += '<tr><td>Arrive time</td><td>' + attractionDetail[0].arrive_time + '</td></tr>';
|
||||
for (var i = 0; i < attractionDetail.length; i++) {
|
||||
detailHtml += '<tr>';
|
||||
detailHtml += '<td><input type="radio" id="train_seat_id" name="train_seat_id" value="' + attractionDetail[i].train_seat_id + '">';
|
||||
detailHtml += attractionDetail[i].class + '</td>';
|
||||
detailHtml += '<td>' + attractionDetail[i].fee + 'RMB</td>';
|
||||
detailHtml += '<td><div style="padding: 10px 20px;background-color: #1E90FF;color: white;cursor: pointer;" onclick="addToPlan(' + attractionDetail[i].train_seat_id + ')">Add to Plan</div></td>';
|
||||
if (i==0){
|
||||
detailHtml += '<tr><td><button id="add_cart">Add cart</button></td></tr>';
|
||||
}
|
||||
detailHtml += '</tr>';
|
||||
}
|
||||
|
||||
detailHtml += '<tr><td><div class="input-field with button"><input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required><label for="start_date">Visit date</label></td>';
|
||||
detailHtml += '<td><div class="input-field"><input type="number" id="quantity" name="quantity" placeholder=" " required value=""><label for="quantity">Quantity</label></div></td></tr>';
|
||||
|
||||
|
||||
detailHtml += '</table>';
|
||||
detailHtml +='<a href="../railway.php" style="text-decoration:none;"><button class="pageButton">Go back</button></a>';
|
||||
document.getElementById("detail").innerHTML = detailHtml;
|
||||
}
|
||||
document.getElementById('add_cart').addEventListener('click', add_cart);
|
||||
}
|
||||
xmlhttp.open("GET", "getRaInfo.php?id=" + aid, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function add_cart() {
|
||||
let start_date = document.getElementById("start_date").value;
|
||||
let quantity = document.getElementById("quantity").value;
|
||||
let price = attractionDetail[0].price; // Now accessible
|
||||
let product_id = document.getElementById("train_seat_id").value;
|
||||
|
||||
window.location.href = '../addcart.php?target_id=' + product_id + '&start_date=' + start_date + '&end_date=NULL&quantity=' + quantity + '&table=6&price=' + price;
|
||||
}
|
||||
|
||||
GoodFunction();
|
||||
|
||||
function addToPlan(trainClassId) {
|
||||
var startDate = prompt("Select visit_date:", formatDate(new Date()));
|
||||
if (startDate) {
|
||||
var url = `../plans_do.php?trainClassId=${trainClassId}&visit_date=${startDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
</script>
|
||||
<div id="detail"></div><br><br><br>
|
||||
<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>
|
||||
19
indexes/user/getInfo/getAtInfo.php
Normal file
19
indexes/user/getInfo/getAtInfo.php
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
$sql = "SELECT attraction.attraction_id, name,location,open_time,close_time,open_day,close_day,attraction_type.attraction_type_name,price,descrip,attraction_type.attraction_type_image
|
||||
FROM attraction JOIN attraction_type USING(attraction_type_id)
|
||||
WHERE attraction_id=".$id;
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["attraction_type_image"] = base64_encode($row["attraction_type_image"]);
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
44
indexes/user/getInfo/getFlInfo.php
Normal file
44
indexes/user/getInfo/getFlInfo.php
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
|
||||
$sql = "SELECT
|
||||
transport_flight.flight_id,
|
||||
transport_flight.flight_code,
|
||||
departure_city.name AS from_name,
|
||||
arrival_city.name AS dest_name,
|
||||
departure_airport.name AS departure_airport_name,
|
||||
arrival_airport.name AS arrival_airport_name,
|
||||
flight_class_id,
|
||||
week_routine,
|
||||
takeoff_time,
|
||||
class,
|
||||
fee,
|
||||
landing_time
|
||||
FROM
|
||||
transport_flight
|
||||
JOIN
|
||||
transport_airport AS departure_airport ON transport_flight.from_airport_id = departure_airport.airport_id
|
||||
JOIN
|
||||
transport_airport AS arrival_airport ON transport_flight.dest_airport_id = arrival_airport.airport_id
|
||||
JOIN
|
||||
transport_airline ON transport_flight.airline_id = transport_airline.airline_id
|
||||
JOIN
|
||||
cities AS departure_city ON departure_airport.city_id = departure_city.id
|
||||
JOIN transport_flight_class USING (flight_id)
|
||||
JOIN cities AS arrival_city ON arrival_airport.city_id = arrival_city.id
|
||||
WHERE flight_id=".$id;
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
|
||||
37
indexes/user/getInfo/getFoInfo.php
Normal file
37
indexes/user/getInfo/getFoInfo.php
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
$sql = "SELECT
|
||||
restaurant.restaurant_id,
|
||||
restaurant.name AS rname,
|
||||
cities.name AS cname,
|
||||
restaurant.location,
|
||||
restaurant.open_day,
|
||||
restaurant.close_day,
|
||||
restaurant.open_time,
|
||||
restaurant.close_time,
|
||||
restaurant.rating,
|
||||
restaurant_style.restaurant_style_name,
|
||||
restaurant.descrip,
|
||||
restaurant.fee,
|
||||
restaurant_style.restaurant_style_image AS image
|
||||
FROM
|
||||
restaurant
|
||||
JOIN
|
||||
cities ON restaurant.city_id = cities.id
|
||||
JOIN
|
||||
restaurant_style ON restaurant.restaurant_style_id = restaurant_style.restaurant_style_id
|
||||
WHERE restaurant_id=".$id;
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
28
indexes/user/getInfo/getGuInfo.php
Normal file
28
indexes/user/getInfo/getGuInfo.php
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
$sql = "SELECT
|
||||
user_guide.u_id,
|
||||
user_guide.username,
|
||||
user_guide.working_age,
|
||||
guide_type.guide_type_name,
|
||||
user_guide.rating,
|
||||
user_guide.fee,
|
||||
user_guide.descrip
|
||||
FROM
|
||||
user_guide
|
||||
JOIN
|
||||
guide_type ON user_guide.guide_type_id = guide_type.guide_type_id
|
||||
WHERE user_guide.u_id=".$id;
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
34
indexes/user/getInfo/getHoInfo.php
Normal file
34
indexes/user/getInfo/getHoInfo.php
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
$sql = "SELECT
|
||||
hotel.hotel_id,
|
||||
hotel.location,
|
||||
hotel.name AS 'hname',
|
||||
hotel_room_type.room_type_name AS 'rType',
|
||||
hotel_room.price AS 'price',
|
||||
hotel_room.hotel_room_id,
|
||||
hotel.descrip,
|
||||
hotel_type.hotel_type_image AS image
|
||||
FROM
|
||||
hotel
|
||||
JOIN
|
||||
hotel_room ON hotel.hotel_id = hotel_room.hotel_id
|
||||
JOIN
|
||||
hotel_room_type ON hotel_room.room_type_id = hotel_room_type.room_type_id
|
||||
JOIN hotel_type USING(hotel_type_id)
|
||||
WHERE hotel.hotel_id=".$id;
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$row["image"] = base64_encode($row["image"]);
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
|
||||
43
indexes/user/getInfo/getRaInfo.php
Normal file
43
indexes/user/getInfo/getRaInfo.php
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
$id = $_REQUEST["id"];
|
||||
|
||||
$sql = "SELECT
|
||||
transport_railway.train_id,
|
||||
transport_railway.train_code,
|
||||
departure_station.name AS departure_station_name,
|
||||
arrival_station.name AS arrival_station_name,
|
||||
departure_city.name AS from_name,
|
||||
arrival_city.name AS dest_name,
|
||||
train_seat_id,
|
||||
transport_railway.start_time,
|
||||
transport_railway.arrive_time,
|
||||
class,
|
||||
fee,
|
||||
transport_railway.week_routine
|
||||
FROM
|
||||
transport_railway
|
||||
JOIN
|
||||
transport_railway_station AS departure_station ON transport_railway.from_station_id = departure_station.station_id
|
||||
JOIN
|
||||
transport_railway_station AS arrival_station ON transport_railway.dest_station_id = arrival_station.station_id
|
||||
JOIN
|
||||
cities AS departure_city ON departure_station.city_id = departure_city.id
|
||||
JOIN
|
||||
cities AS arrival_city ON arrival_station.city_id = arrival_city.id
|
||||
JOIN transport_railway_class USING (train_id)
|
||||
WHERE train_id=".$id;
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$attractionDetail = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$attractionDetail [] = $row;
|
||||
}
|
||||
} else {
|
||||
$attractionDetail [] = "No result";
|
||||
}
|
||||
echo json_encode($attractionDetail);
|
||||
?>
|
||||
|
||||
45
indexes/user/getRailway.php
Normal file
45
indexes/user/getRailway.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
$destinationCity = $_REQUEST["destinationCity"];
|
||||
$departureCity = $_REQUEST["departureCity"];
|
||||
|
||||
|
||||
// Fetch flight information from the database that matches the departure and destination cities
|
||||
$start=microtime(true);
|
||||
$sql = "SELECT
|
||||
transport_railway.train_id,
|
||||
transport_railway.train_code,
|
||||
departure_city.name AS from_name,
|
||||
arrival_city.name AS dest_name,
|
||||
transport_railway.start_time,
|
||||
transport_railway.arrive_time,
|
||||
transport_railway.week_routine
|
||||
FROM
|
||||
transport_railway
|
||||
JOIN
|
||||
transport_railway_station AS departure_station ON transport_railway.from_station_id = departure_station.station_id
|
||||
JOIN
|
||||
transport_railway_station AS arrival_station ON transport_railway.dest_station_id = arrival_station.station_id
|
||||
JOIN
|
||||
cities AS departure_city ON departure_station.city_id = departure_city.id
|
||||
JOIN
|
||||
cities AS arrival_city ON arrival_station.city_id = arrival_city.id
|
||||
WHERE arrival_city.name LIKE '%".$destinationCity."%' AND departure_city.id='".$departureCity."'";
|
||||
$result = $conn->query($sql);
|
||||
$end = microtime(true);
|
||||
$execution_time = $end - $start;
|
||||
$data = array();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$data[] = $row;
|
||||
}
|
||||
} else {
|
||||
$data[] = "No result";
|
||||
}
|
||||
|
||||
echo json_encode(array("data" => $data,"time"=>$execution_time));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
291
indexes/user/guiding.php
Normal file
291
indexes/user/guiding.php
Normal file
@@ -0,0 +1,291 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Guide@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>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:5%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
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;
|
||||
}
|
||||
</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'] === 'seller'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../seller/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>";
|
||||
}
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'guide'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../guide/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="myInput" placeholder="search guide"></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">
|
||||
<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="#" style="border-color: white;">
|
||||
<img src="../../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
<a href="plans.php">
|
||||
<img src="../../icon/header/plans.svg" alt="Plans">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div id="pageContainer" style="display: block;">
|
||||
<br>
|
||||
<br><br><div style="text-align:center;">
|
||||
<button class="pagebutton" onclick="myFunction()" style="width:50%; height:10%; text-align:center; font-family: Times New Roman, Times, serif; color:red; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); cursor:pointer;">
|
||||
Click here to get the full list of guide</button></div>
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<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>
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
function changePage(pageNumber) {
|
||||
currentPage = pageNumber;
|
||||
myFunction();
|
||||
}
|
||||
|
||||
function myFunction() {
|
||||
var input = document.getElementById('myInput');
|
||||
var filter = 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;
|
||||
totalPages = response.total_pages;
|
||||
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>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='<div style="font-size: 40px; color: black;text-align: center;">Here is the guide 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" x>';
|
||||
html += '<table style="border: none; cursor:pointer;" onclick="window.open(\'./getInfo/GuInfo.php?id=' + data[i].u_id + '\', \'_blank\');">';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].username+ '</p></td></tr>';
|
||||
html += '<tr><td>Type</td><td>' + data[i].typename + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Fee</td><td>' + data[i].fee + 'RMB</td></tr>';
|
||||
html += '</table>';
|
||||
html += '<button style="width: 10%; height: 40px;" onclick="addToPlan(\'' + data[i].u_id + '\')" >ADD</button>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
generatePageButtons();
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "getGuide.php?q="+filter+"&page="+currentPage, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
function addToPlan(uid) {
|
||||
var startDate = prompt("Select start date:", formatDate(new Date()));
|
||||
var endDate = prompt("Select end date:", formatDate(new Date()));
|
||||
if (startDate && endDate) {
|
||||
var url = `./plans_do.php?uid=${uid}&startDate=${startDate}&endDate=${endDate}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error adding to the plan. Status code: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 0) {
|
||||
alert(data.msg)
|
||||
} else {
|
||||
console.error(`Error adding to the plan. Message: ${data.message}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fetch error:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
|
||||
function generatePageButtons() {
|
||||
var html = '';
|
||||
var startPage = Math.max(currentPage - 2, 1);
|
||||
var endPage = Math.min(currentPage + 2, totalPages);
|
||||
var html2='';
|
||||
|
||||
|
||||
// Always add the first page button
|
||||
if ((currentPage != 1||currentPage != 2||currentPage == 3)&&endPage!=0) {
|
||||
html += '<button class="pagebutton" onclick="changePage(1)">1</button>';
|
||||
}
|
||||
|
||||
// Add "..." before current pages
|
||||
if (startPage > 2&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Add buttons for current pages
|
||||
for (var i = startPage+1; i <= endPage; i++) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + i + ')">' + i + '</button>';
|
||||
}
|
||||
|
||||
// Add "..." after current pages
|
||||
if (endPage < totalPages - 1&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Always add the last page button
|
||||
if (currentPage != totalPages && totalPages != 2&& totalPages != 3&& totalPages != 4&& totalPages != 5) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + totalPages + ')">' + totalPages + '</button>';
|
||||
}
|
||||
|
||||
document.getElementById("pageButtons").innerHTML = html;
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
382
indexes/user/home.css
Normal file
382
indexes/user/home.css
Normal file
@@ -0,0 +1,382 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #f0f0f0;
|
||||
font-family: 'Söhne', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
padding-top: 0.5%;
|
||||
padding-left: 5%;
|
||||
padding-right: 5%;
|
||||
color: white;
|
||||
background-color: #003b94;
|
||||
user-select: none;
|
||||
pointer-events: auto;
|
||||
-webkit-user-drag: none;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
width: 16%;
|
||||
height: auto;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
padding-top: 0.5%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 5%;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
color: white;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
margin-left: 10%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav-links a:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.nav-links img{
|
||||
width: auto;
|
||||
height: 80%;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
border-radius: 12px;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
.nav-links img:hover{
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
border-radius: 12px;
|
||||
background-color: #878686;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
nav {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
padding-bottom: 0.5%;
|
||||
margin: 0;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
nav::-webkit-scrollbar {
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
nav::-webkit-scrollbar-thumb {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
nav a {
|
||||
padding: 1%;
|
||||
border-radius: 160px;
|
||||
display: inline-block;
|
||||
border: 1px solid transparent;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
nav a img {
|
||||
height: 24px;
|
||||
object-fit: cover;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
nav a:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
nav a:focus {
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
header{
|
||||
padding-top: 0.5%;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
font-size: 90%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
padding-right: 2%;
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
margin-left: 2%;
|
||||
width: 30%;
|
||||
max-height: 100px;
|
||||
}
|
||||
|
||||
nav a img {
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin-left: 1%;
|
||||
margin-top: 2%;
|
||||
padding: 1.2%;
|
||||
}
|
||||
}
|
||||
.hotel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: left;
|
||||
border: 1px solid #000000;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
height: 350px;
|
||||
width:1100px;
|
||||
background-color: #ddd;
|
||||
border-radius: 15px;
|
||||
font-size:40px;
|
||||
}
|
||||
#hint{
|
||||
font-size: 50px;
|
||||
margin-left:100px;
|
||||
}
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 32px;
|
||||
margin-left:100px;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
margin: 4px 2px;
|
||||
border-radius: 15px;
|
||||
font-size:30px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
.pagebutton:hover{
|
||||
background-color:#87CEFA;
|
||||
}
|
||||
.pagebutton:active{
|
||||
background-color:#1E90FF;
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
table{
|
||||
border: 1px solid #000000;
|
||||
background-color: white;
|
||||
border-radius: 15px;
|
||||
padding: 15px;
|
||||
border:1px solid black;
|
||||
width:600px;
|
||||
height:300px;
|
||||
}
|
||||
|
||||
footer{
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
padding: 1% 5%;
|
||||
color: white;
|
||||
background-color: #003b94;
|
||||
user-select: none;
|
||||
pointer-events: auto;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
.sticky-search-box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center; /* Center align the contents */
|
||||
align-items: center;
|
||||
position: sticky; /* Default to sticky */
|
||||
top: 0;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
padding: 5px;
|
||||
z-index: 1000;
|
||||
width: 95%; /* Full width */
|
||||
margin: 0 auto; /* Center align the box itself */
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#searchForm {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%; /* Full width */
|
||||
justify-content: center; /* Center align form elements */
|
||||
}
|
||||
|
||||
.input-field, .input-field.with-button {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 0;
|
||||
flex-grow: 1; /* Allow fields to grow */
|
||||
flex-shrink: 1; /* Allow fields to shrink */
|
||||
}
|
||||
|
||||
.input-field input[type="date"], .input-field.with-button select {
|
||||
width: 90%; /* Full width */
|
||||
}
|
||||
|
||||
#searchForm button {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 0;
|
||||
flex-grow: 0; /* Prevent the button from growing */
|
||||
flex-shrink: 1;
|
||||
min-width: 70px; /* Minimum width for the button */
|
||||
max-width: 70px;
|
||||
}
|
||||
|
||||
/* Responsive Design for Computer Screens */
|
||||
@media screen and (min-width: 1100px) {
|
||||
#searchForm {
|
||||
flex-wrap: nowrap; /* Prevent wrapping on larger screens */
|
||||
}
|
||||
.input-field, .input-field.with-button {
|
||||
flex-basis: 50%; /* Each field takes half the width */
|
||||
}
|
||||
|
||||
#searchForm button {
|
||||
flex-basis: 100%; /* Button takes full width on small screens */
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive Design for Phone Screens */
|
||||
@media screen and (max-width: 700px) {
|
||||
.sticky-search-box {
|
||||
position: static; /* Non-sticky on small screens */
|
||||
}
|
||||
}
|
||||
|
||||
.input-field {
|
||||
position: relative;
|
||||
margin-bottom: 5%;
|
||||
height: 40px;
|
||||
padding: 2px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.input-field input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
background-color: transparent;
|
||||
font-size: medium;
|
||||
transition: top 0.2s ease, left 0.3s ease, font-size 0.3s ease, color 0.3s;
|
||||
}
|
||||
|
||||
.input-field label {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 10px;
|
||||
color: #999;
|
||||
transform: translateY(-50%);
|
||||
transition: top 0.2s ease, left 0.3s ease, font-size 0.3s ease, color 0.3s;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.input-field input:focus + label {
|
||||
top: -1%;
|
||||
font-size: 12px;
|
||||
color: #007bff;
|
||||
background-color: #fdfdfd;
|
||||
border: white 2px solid;
|
||||
}
|
||||
|
||||
.input-field input:not(:placeholder-shown) + label {
|
||||
top: -1%;
|
||||
font-size: 12px;
|
||||
background-color: #fdfdfd;
|
||||
border: white 2px solid;
|
||||
}
|
||||
|
||||
.input-field:focus-within {
|
||||
border: 1px solid #007bff;
|
||||
}
|
||||
|
||||
.input-field.with-button {
|
||||
display: flex;
|
||||
border-radius: 5px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.input-field.with-button select{
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.input-field.with-button input {
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
cursor: pointer;
|
||||
margin-right: 2%;
|
||||
color: #007bff;
|
||||
background-color: #fdfdfd;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
padding: 5px 10px;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.edit-button:hover {
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
height: 43px;
|
||||
padding: 10px;
|
||||
font-size: medium;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.input-field input[type="date"] {
|
||||
width: 100%; /* Full width */
|
||||
padding: 8px; /* Padding inside input */
|
||||
border: 1px solid #ddd; /* Border color */
|
||||
border-radius: 4px; /* Rounded corners */
|
||||
}
|
||||
91
indexes/user/home.php
Normal file
91
indexes/user/home.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<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">
|
||||
</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'] === 'seller'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../seller/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>";
|
||||
}
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'guide'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../guide/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">
|
||||
<?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">
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
<footer>
|
||||
<img src="../../icon/favicon/logo_white.svg" alt="RoamEase" width="300px">
|
||||
<div style="margin: 20px 0;">
|
||||
<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>
|
||||
<p>© 2023 COMP3013 Group10. All rights reserved.</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
116
indexes/user/modify.php
Normal file
116
indexes/user/modify.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<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="./user/home.css?version=1" type="text/css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<SCRIPT src="js/jquery.js" type=text/javascript></SCRIPT>
|
||||
<SCRIPT src="js/jquery.cross-slide.js" type=text/javascript></SCRIPT>
|
||||
<style type=text/css>
|
||||
#rotator {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
|
||||
.body{
|
||||
background: url("modify.jpg");
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
</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="home.php"><img src="../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="#">CNY</a>
|
||||
<a href="#">Search</a>
|
||||
<?php
|
||||
if (isset($_SESSION['loggedin'])) {
|
||||
echo '<a href="#">Cart</a><a href="#">Account</a>';
|
||||
}
|
||||
else {
|
||||
echo '<a href="#">Sign up</a><a href="../login/username.php">Log in</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="#">
|
||||
<img src="../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../icon/header/transportations.svg" alt="Transportations">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../icon/header/foods.svg" alt="Foods">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../icon/header/attractions.svg" alt="Attractions">
|
||||
</a>
|
||||
<a href="#">
|
||||
<img src="../icon/header/guiding.svg" alt="Guiding">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div style="font-size: 40px; color:black;text-align: center;" >modify the business</div>
|
||||
<table border="1px" align="center">
|
||||
<tr bgcolor="#f0f0f0">
|
||||
<th></th>
|
||||
<th>name</th>
|
||||
<th>delete</th>
|
||||
|
||||
</tr>
|
||||
<tr bgcolor="#f0f0f0">
|
||||
<td>Day 1</td>
|
||||
<td>Hotel AB</td>
|
||||
<th><button>delete</button></th>
|
||||
</tr>
|
||||
<tr bgcolor="#f0f0f0">
|
||||
<td>Day 2</td>
|
||||
<td>Hotel BS</td>
|
||||
<th><button>delete</button></th>
|
||||
</tr>
|
||||
<tr bgcolor="#f0f0f0">
|
||||
<td>Day 3</td>
|
||||
<td>Hotel IS</td>
|
||||
<th><button>delete</button></th>
|
||||
</tr>
|
||||
</table><br>
|
||||
</body>
|
||||
326
indexes/user/plans.php
Normal file
326
indexes/user/plans.php
Normal file
@@ -0,0 +1,326 @@
|
||||
<?php
|
||||
session_start();
|
||||
include '../ConnectDB.php';
|
||||
|
||||
$uid = $_SESSION['uid'] ?? 0;
|
||||
$data = $_GET;
|
||||
|
||||
$data['page'] = $data['page'] ?? 1;
|
||||
|
||||
$data['pageSize'] = 5;
|
||||
$sql = "select * from bookings where uid = {$uid} ";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$result = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
||||
$total = count($result);
|
||||
|
||||
$totalPage = ceil($total / $data['pageSize']);
|
||||
$offset = ($data['page'] - 1) * $data['pageSize'];
|
||||
$sql = "select * from bookings where uid = {$uid} limit {$offset},{$data['pageSize']} ";
|
||||
|
||||
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$result = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
||||
|
||||
foreach ($result as $k => $v) {
|
||||
$table = [
|
||||
'attraction_booking',
|
||||
'hotel_booking',
|
||||
'restaurant_booking',
|
||||
'guide_booking',
|
||||
'transport_flight_booking',
|
||||
'transport_railway_booking'
|
||||
];
|
||||
foreach ($table as $item) {
|
||||
if ($item == 'hotel_booking') {
|
||||
$sql = "select h.name,hy.room_type_name,t1.price as fee from $item as t
|
||||
join hotel_room as t1 on t1.hotel_room_id = t.hotel_room_id
|
||||
join hotel as h on t1.hotel_id = h.hotel_id
|
||||
join hotel_room_type as hy on hy.room_type_id = t1.room_type_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
|
||||
}
|
||||
if ($item == 'attraction_booking') {
|
||||
$sql = "select a.name,a.price as fee from $item as t
|
||||
join attraction as a on a.attraction_id =t.attraction_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
|
||||
}
|
||||
if ($item == 'restaurant_booking') {
|
||||
$sql = "select t1.name,t1.fee from $item as t
|
||||
join restaurant as t1 on t1.restaurant_id = t.restaurant_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
}
|
||||
|
||||
if ($item == 'guide_booking') {
|
||||
$sql = "select g.username,g.fee from $item as t
|
||||
join user_guide as g on g.u_id = t.guide_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
}
|
||||
if ($item == 'transport_flight_booking') {
|
||||
$sql = "select flight_code, class, fc.fee from $item as t
|
||||
join transport_flight_class as fc on fc.flight_class_id = t.flight_class_id
|
||||
join transport_flight as f on f.flight_id = fc.flight_id
|
||||
join transport_airline as a on a.airline_id = f.airline_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
}
|
||||
if ($item == 'transport_railway_booking') {
|
||||
$sql = "select train_code, class, rs.fee from $item as t
|
||||
join transport_railway_class as rs on rs.train_seat_id = t.railway_class_id
|
||||
join transport_railway as r on r.train_id = rs.train_id
|
||||
where booking_id = " . $v['booking_id'];
|
||||
}
|
||||
|
||||
|
||||
$result2 = mysqli_query($conn, $sql);
|
||||
$result2 = mysqli_fetch_all($result2, MYSQLI_ASSOC);
|
||||
$result[$k][$item] = $result2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Plans@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>
|
||||
.pagebutton1{
|
||||
width:120px;
|
||||
height:50px;
|
||||
}
|
||||
.pagebutton2{
|
||||
width:120px;
|
||||
height:50px;
|
||||
}
|
||||
.receipt{
|
||||
background-color:rgba(240,220,200,0.5);
|
||||
}
|
||||
|
||||
.day-plan {
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
}
|
||||
.buttonAdd{
|
||||
background-color: #28a745;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
transition:background-color 0.3s ease;
|
||||
cursor:pointer;
|
||||
}
|
||||
.buttonAdd:hover{
|
||||
background-color:#28a745;
|
||||
}
|
||||
.buttonAdd:active{
|
||||
background-color:green;
|
||||
transform: translateY(1px);
|
||||
}
|
||||
th{
|
||||
text-align:left;
|
||||
}
|
||||
table, th {
|
||||
border-bottom: 2px solid grey;
|
||||
}
|
||||
.tablePlan{
|
||||
border-radius:0px;
|
||||
border-right: 1px solid black;
|
||||
border-left: 1px solid black;
|
||||
border-top: 1px solid white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../index.php"><img src="../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?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">
|
||||
<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" style="border-color: white;">
|
||||
<img src="../../icon/header/plans.svg" alt="Plans">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div >
|
||||
<div class="buttonAdd" style="margin-top: 20px;margin-bottom: 20px;" onclick="addPlan()">
|
||||
<a href="#" style="text-decoration: none; color:white; font-size:19px;" class="btn btn-success" >Add Plan</a>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function addPlan() {
|
||||
|
||||
var day = prompt("Enter the day:");
|
||||
if (day !== null) {
|
||||
|
||||
var url = "./plans_do.php?type=add&day=" + encodeURIComponent(day);
|
||||
|
||||
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<table class="tablePlan" style="width:90%; ">
|
||||
<thead>
|
||||
<tr border-bottom: 1px>
|
||||
<th scope="col">Day</th>
|
||||
<th scope="col">Hotel Name</th>
|
||||
<th scope="col">Attraction Name</th>
|
||||
<th scope="col">Restaurant Name</th>
|
||||
<th scope="col">Guiding Name</th>
|
||||
<th scope="col">Flight</th>
|
||||
<th scope="col">Railway</th>
|
||||
<th scope="col">Total Fee</th>
|
||||
<th scope="col">Operate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($result as $k => $v) {
|
||||
$total = 0;
|
||||
?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<p><?php echo $v['day'] . ' DAY'; ?></p>
|
||||
<a class="buttonAdd" href="plans_do.php?type=change&id=<?php echo $v['booking_id'];?>" >
|
||||
<?php
|
||||
if (isset($_SESSION['bid']) && $_SESSION['bid'] == $v['booking_id']) {
|
||||
echo '<b><i>Current</b></i>';
|
||||
} else {
|
||||
echo 'select';
|
||||
}
|
||||
?>
|
||||
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<?php foreach ($v['hotel_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['name'] . '--' . $v1['room_type_name'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php foreach ($v['attraction_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['name'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php foreach ($v['restaurant_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['name'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php foreach ($v['guide_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['username'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php foreach ($v['transport_flight_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['flight_code'] . '--' . $v1['class'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php foreach ($v['transport_railway_booking'] as $v1) {
|
||||
$total = bcadd($total, $v1['fee'], 2);
|
||||
?>
|
||||
<p>
|
||||
<?php echo $v1['train_code'] . '--' . $v1['class'] . '--¥' . $v1['fee']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $total; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="./plans_do.php?type=reset&id=<?php echo $v['booking_id']?>" class="buttonAdd">Reset Day</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
305
indexes/user/plans2.php
Normal file
305
indexes/user/plans2.php
Normal file
@@ -0,0 +1,305 @@
|
||||
<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>
|
||||
.pagebutton1{
|
||||
width:120px;
|
||||
height:50px;
|
||||
}
|
||||
.pagebutton2{
|
||||
width:120px;
|
||||
height:50px;
|
||||
}
|
||||
.receipt{
|
||||
background-color:rgba(240,220,200,0.5);
|
||||
|
||||
}
|
||||
|
||||
.day-plan {
|
||||
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<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'] === 'seller'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../seller/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>";
|
||||
}
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'guide'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../guide/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">
|
||||
<?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">
|
||||
<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" style="border-color: white;">
|
||||
<img src="../../icon/header/plans.svg" alt="Plans">
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<h1>Travel Plan</h1>
|
||||
|
||||
<?php
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['visit_date'])) {
|
||||
$_SESSION['visit_date'] = 1;
|
||||
}
|
||||
|
||||
if (isset($_GET['nextday'])) {
|
||||
$_SESSION['visit_date'] += 1;
|
||||
}
|
||||
if (!isset($_SESSION['page'])) {
|
||||
$_SESSION['page'] = 1;
|
||||
}
|
||||
if (isset($_GET['nextpage'])) {
|
||||
$_SESSION['page'] += 1;
|
||||
}
|
||||
if (isset($_GET['lastpage']) && $_SESSION['page'] > 1) {
|
||||
$_SESSION['page'] -= 1;
|
||||
}
|
||||
|
||||
$start_day = ($_SESSION['page'] - 1) * 3 + 1;
|
||||
$end_day = $start_day + 2;
|
||||
|
||||
|
||||
if (isset($_GET['resetday'])) {
|
||||
$_SESSION['visit_date'] = 1;
|
||||
|
||||
|
||||
$sql = "DELETE FROM stay_plan";
|
||||
if ($conn->query($sql) !== TRUE) {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
|
||||
|
||||
$sql = "DELETE FROM restaurant_booking";
|
||||
if ($conn->query($sql) !== TRUE) {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
|
||||
|
||||
$sql = "DELETE FROM attraction_plan";
|
||||
if ($conn->query($sql) !== TRUE) {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
|
||||
|
||||
$sql = "DELETE FROM guide_plan";
|
||||
if ($conn->query($sql) !== TRUE) {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$visit_date = $_SESSION['visit_date'];
|
||||
|
||||
if (isset($_GET['hotel_id'])) {
|
||||
$hotel_id = $_GET['hotel_id'];
|
||||
$sql = "INSERT INTO hotel_booking (visit_date, hotel_id) VALUES ('$visit_date', '$hotel_id')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['restaurant_id'])) {
|
||||
$restaurant_id = $_GET['restaurant_id'];
|
||||
$sql = "INSERT INTO restaurant_booking (visit_date,booking_id, restaurant_id) VALUES ('$visit_date','$booking_id', '$restaurant_id')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
if (isset($_GET['attraction_id'])) {
|
||||
$attraction_id = $_GET['attraction_id'];
|
||||
$sql = "INSERT INTO attraction_booking (visit_date, booking_id, attraction_id) VALUES ('$visit_date', '$booking_id', '$attraction_id')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
if (isset($_GET['u_id'])) {
|
||||
$u_id = $_GET['u_id'];
|
||||
$sql = "INSERT INTO guide_booking (visit_date, booking_id, guide_id) VALUES ('$visit_date', '$booking_id', '$u_id')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//echo "<div class='day-plan'>";
|
||||
// echo "<table><tr><th>Day</th><th>Hotel Name</th><th>Restaurant Name</th><th>Attraction Name</th><th>Guiding Name</th></tr>";
|
||||
|
||||
for ($visit_date = $start_day; $visit_date <= min($end_day, $_SESSION['visit_date']); $visit_date++){
|
||||
|
||||
echo "<table><tr><th>Day</th><th>Hotel Name</th><th>Restaurant Name</th><th>Attraction Name</th><th>Guiding Name</th></tr>";
|
||||
|
||||
$sql = "SELECT hotel_id FROM hotel_booking WHERE visit_date = $visit_date";
|
||||
$result = $conn->query($sql);
|
||||
$hotel_ids = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$hotel_ids[] = $row["hotel_id"];
|
||||
}
|
||||
$hotel_names = [];
|
||||
foreach ($hotel_ids as $hotel_id) {
|
||||
$sql = "SELECT name FROM hotel WHERE hotel_id = $hotel_id";
|
||||
$result = $conn->query($sql);
|
||||
if ($row = $result->fetch_assoc()) {
|
||||
$hotel_names[] = $row["name"];
|
||||
}
|
||||
}
|
||||
$hotel_name = count($hotel_names) > 0 ? implode(", ", $hotel_names) : "No stay plan";
|
||||
|
||||
$sql = "SELECT restaurant_id FROM restaurant_booking WHERE visit_date = $visit_date";
|
||||
$result = $conn->query($sql);
|
||||
$restaurant_ids = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$restaurant_ids[] = $row["restaurant_id"];
|
||||
}
|
||||
|
||||
$restaurant_names = [];
|
||||
foreach ($restaurant_ids as $restaurant_id) {
|
||||
$sql = "SELECT name FROM restaurant WHERE restaurant_id = $restaurant_id";
|
||||
$result = $conn->query($sql);
|
||||
if ($row = $result->fetch_assoc()) {
|
||||
$restaurant_names[] = $row["name"];
|
||||
}
|
||||
}
|
||||
$restaurant_name = count($restaurant_names) > 0 ? implode(", ", $restaurant_names) : "No food plan";
|
||||
|
||||
$sql = "SELECT attraction_id FROM transport_flight_booking WHERE visit_date = $visit_date";
|
||||
$result = $conn->query($sql);
|
||||
$attraction_ids = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$attraction_ids[] = $row["attraction_id"];
|
||||
}
|
||||
|
||||
$attraction_names = [];
|
||||
foreach ($attraction_ids as $attraction_id) {
|
||||
$sql = "SELECT name FROM attraction WHERE attraction_id = $attraction_id";
|
||||
$result = $conn->query($sql);
|
||||
if ($row = $result->fetch_assoc()) {
|
||||
$attraction_names[] = $row["name"];
|
||||
}
|
||||
}
|
||||
$attraction_name = count($attraction_names) > 0 ? implode(", ", $attraction_names) : "No attraction plan";
|
||||
|
||||
$sql = "SELECT guide_id FROM guide_booking WHERE visit_date = $visit_date";
|
||||
$result = $conn->query($sql);
|
||||
$guide_ids = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$guide_ids[] = $row["guide_id"];
|
||||
}
|
||||
|
||||
$guide_names = [];
|
||||
foreach ($guide_ids as $guide_id) {
|
||||
$sql = "SELECT username FROM guide WHERE u_id = $guide_id";
|
||||
$result = $conn->query($sql);
|
||||
if ($row = $result->fetch_assoc()) {
|
||||
$guide_names[] = $row["username"];
|
||||
}
|
||||
}
|
||||
$guide_name = count($guide_names) > 0 ? implode(", ", $guide_names) : "No guiding plan";
|
||||
|
||||
|
||||
echo "<tr><td>Day " . $day . "</td><td>" . $hotel_name . "</td><td>" . $restaurant_name . "</td><td>" . $attraction_name . "</td><td>" . $guide_name . "</td></tr></table>";
|
||||
|
||||
echo "</div>";
|
||||
echo "</table>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
</body>
|
||||
|
||||
<div style="text-align: center; margin: 20px 0;" >
|
||||
<p style="font-size:25px">Current page: <?php echo $_SESSION['page']; ?></p>
|
||||
<button class="pagebutton1" onclick="window.location.href='?nextday=1'">Next Day</button>
|
||||
<button class="pagebutton1" onclick="window.location.href='?resetday=1'">Reset Day</button>
|
||||
<button class="pagebutton2" onclick="if (<?php echo $_SESSION['day']; ?> > <?php echo $_SESSION['page'] * 3; ?>) window.location.href='?nextpage=1'">Next Page</button>
|
||||
<button class="pagebutton2" onclick="window.location.href='?lastpage=1'">Last Page</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center; margin: 0px 0; " class="receipt">
|
||||
<a href="receipt.html" class="bottom-link" style="color:white;font-size:25px; background-color:rgba(225,249,255,0.5)">confirm.</a><br><br>
|
||||
<a href="recharge.html" class="bottom-link" style="color:white;font-size:25px; background-color:rgba(225,249,255,0.5)">if you don't have enough money,click here to recharge.</a>
|
||||
<br><br><br><br><br><br>
|
||||
</html>
|
||||
129
indexes/user/plans_do.php
Normal file
129
indexes/user/plans_do.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
session_start();
|
||||
include "../ConnectDB.php";
|
||||
$bid = $_SESSION['bid'] ?? '';
|
||||
if (isset($_GET['roomId'])) {
|
||||
$room_id = $_GET['roomId'];
|
||||
$start_date = $_GET['startDate'];
|
||||
$end_date = $_GET['endDate'];
|
||||
$sql = "INSERT INTO hotel_booking (hotel_room_id,booking_id,start_date,end_date) VALUES ('$room_id',$bid,'{$start_date}','{$end_date}')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['uid'])) {
|
||||
$uid = $_GET['uid'];
|
||||
$start_date = $_GET['startDate'];
|
||||
$end_date = $_GET['endDate'];
|
||||
$sql = "INSERT INTO guide_booking (guide_id,booking_id,start_date,end_date) VALUES ('$uid',$bid,'{$start_date}','{$end_date}')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['attraction_id'])) {
|
||||
$attraction_id = $_GET['attraction_id'];
|
||||
$visit_date = $_GET['visit_date'];
|
||||
|
||||
$sql = "INSERT INTO attraction_booking (attraction_id,booking_id,visit_date) VALUES ('$attraction_id',$bid,'{$visit_date}')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['restaurant_id'])) {
|
||||
$restaurant_id = $_GET['restaurant_id'];
|
||||
$visit_date = $_GET['visit_date'];
|
||||
|
||||
$sql = "INSERT INTO restaurant_booking (restaurant_id,booking_id,visit_date) VALUES ('$restaurant_id',$bid,'{$visit_date}')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['flightClassId'])) {
|
||||
$flight_class_id = $_GET['flightClassId'];
|
||||
$visit_date = $_GET['visit_date'];
|
||||
$sql = "INSERT INTO transport_flight_booking (flight_class_id,booking_id,visit_date) VALUES ('$flight_class_id',$bid,'{$visit_date}')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['trainClassId'])) {
|
||||
$train_class_id = $_GET['trainClassId'];
|
||||
$visit_date = $_GET['visit_date'];
|
||||
$sql = "INSERT INTO transport_railway_booking (railway_class_id,booking_id,visit_date) VALUES ('$train_class_id',$bid,'{$visit_date}')";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo json_encode(array("code" => 0, "msg" => "successfully"));
|
||||
exit();
|
||||
} else {
|
||||
echo json_encode(array("code" => 1, "msg" => "Error: " . $sql . "<br>" . $conn->error));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['type']) && $_GET['type'] == 'add') {
|
||||
if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin']) {
|
||||
echo "<script>alert('please login');window.history.go(-1);</script>";
|
||||
exit;
|
||||
}
|
||||
$uid = $_SESSION['uid'];
|
||||
$day = $_GET['day'];
|
||||
$sql = "INSERT INTO `bookings` (`uid`,`day`) VALUES ($uid,'{$day}')";
|
||||
$conn->query($sql);
|
||||
header("Location: ./plans.php");
|
||||
}
|
||||
|
||||
if (isset($_GET['type']) && $_GET['type'] == 'change') {
|
||||
$_SESSION['bid'] = $_GET['id'];
|
||||
header("Location: ./plans.php");
|
||||
}
|
||||
|
||||
if (isset($_GET['type']) && $_GET['type'] == 'reset') {
|
||||
if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin']) {
|
||||
echo "<script>alert('please login');window.history.go(-1);</script>";
|
||||
exit;
|
||||
}
|
||||
$bid = $_GET['id'];
|
||||
$sql = "delete from `transport_railway_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `transport_flight_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `guide_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `restaurant_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `attraction_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `hotel_booking` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
$sql = "delete from `bookings` where booking_id = $bid";
|
||||
$conn->query($sql);
|
||||
|
||||
header("Location: ./plans.php");
|
||||
}
|
||||
129
indexes/user/process/cart.css
Normal file
129
indexes/user/process/cart.css
Normal file
@@ -0,0 +1,129 @@
|
||||
#grid{
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
margin: none;
|
||||
border: none;
|
||||
width: 100%;
|
||||
left:1.5%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-style: rgb(10, 22, 44);
|
||||
user-select: none;
|
||||
}
|
||||
#items{
|
||||
text-align: center;
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
color: black;
|
||||
font-size: 200%;
|
||||
border-radius: 12px;
|
||||
backdrop-filter: blur(4px);
|
||||
margin: 1%;
|
||||
margin-right: 4%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-style: rgb(10, 22, 44);
|
||||
user-select: none;
|
||||
width: 95%;
|
||||
height: 5vw;
|
||||
transition: 0.3s;
|
||||
}
|
||||
#items img{
|
||||
border-radius: 12px;
|
||||
width:40%;
|
||||
height: 40%;
|
||||
margin: none;
|
||||
padding: none;
|
||||
overflow:hidden;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
-webkit-background-size:cover;
|
||||
-moz-background-size:cover;
|
||||
background-size:cover;
|
||||
cursor: hand;
|
||||
transition: 0.5s;
|
||||
}
|
||||
#icon{
|
||||
border-radius: 12%;
|
||||
width: 6%;
|
||||
height: 6%;
|
||||
overflow:hidden;
|
||||
cursor: hand;
|
||||
transition: 0.5s;
|
||||
}
|
||||
#items:hover{
|
||||
box-shadow: 0px 0px 10px rgb(106, 104, 104);
|
||||
}
|
||||
p,h5:hover{
|
||||
cursor: hand;
|
||||
}
|
||||
input{
|
||||
font-size: 80%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
background-color: #00000000;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
input:focus{
|
||||
border-bottom: 2px solid red;
|
||||
width: 80%;
|
||||
}
|
||||
#detail_window{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
transform: scale(1.7);
|
||||
/* 垂直居中 */
|
||||
top: 10%;
|
||||
bottom: 0;
|
||||
height: 50%;
|
||||
/* 水平居中 */
|
||||
left: 0%;
|
||||
right: 0%;
|
||||
width: 57%;
|
||||
margin: auto;
|
||||
|
||||
user-select: none;
|
||||
background-color: rgba(239, 230, 230, 0.5);
|
||||
border: 0px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0px 0px 16px rgb(70, 69, 69);
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
#overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(109, 103, 103, 0.6);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 10000;
|
||||
}
|
||||
#closebutton{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
transform: scale(1.4);
|
||||
top: 14%;
|
||||
height: 2.2%;
|
||||
margin-left: 95%;
|
||||
width: 2.2%;
|
||||
font-size: 80%;
|
||||
user-select: none;
|
||||
border: 0px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0px 0px 16px rgb(142, 142, 142);
|
||||
}
|
||||
#closebutton:hover{
|
||||
background-color: red;
|
||||
}
|
||||
button{
|
||||
height: 32px;
|
||||
width: 300px;
|
||||
border: solid white 0px;
|
||||
background: linear-gradient(to right, rgb(26, 117, 172), rgb(26, 158, 144));
|
||||
color: white;
|
||||
cursor: hand;
|
||||
box-shadow: 0px 0px 0px #424242;
|
||||
transition: 0.3s;
|
||||
border-radius: 5px;
|
||||
}
|
||||
306
indexes/user/process/cart.php
Normal file
306
indexes/user/process/cart.php
Normal file
@@ -0,0 +1,306 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Cart</title>
|
||||
<script src="iframe.js"></script>
|
||||
<script src="./item_modify.js"></script>
|
||||
<link rel="stylesheet" href="./cart.css" type="text/css" />
|
||||
<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">
|
||||
</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['usertype']) && !$_SESSION['usertype'] === 'buyer'){
|
||||
header('Location: ../../../index.php');
|
||||
}
|
||||
}
|
||||
else{
|
||||
header('Location: ../../../index.php');
|
||||
}
|
||||
$u_id = $_SESSION['uid'];
|
||||
?>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../../index.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
if (isset($_SESSION['loggedin'])) {
|
||||
echo '<a href="./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">
|
||||
<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>
|
||||
|
||||
<div id="grid">
|
||||
|
||||
<?php
|
||||
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
$sql_cart_bookings = "SELECT * FROM cart_bookings WHERE u_id='$u_id'";
|
||||
$result_cart_bookings = mysqli_query($conn, $sql_cart_bookings);
|
||||
$num_rows = mysqli_num_rows($result_cart_bookings);
|
||||
|
||||
while ($cartBooking = mysqli_fetch_assoc($result_cart_bookings)) {
|
||||
$booking_id = $cartBooking['booking_id'];
|
||||
// Use a switch statement for different booking types
|
||||
switch ($cartBooking['booking_type_id']) {
|
||||
case '1':
|
||||
$bookingQuery = "SELECT * FROM hotel_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['hotel_room_id'];
|
||||
$start_date = $bookingDetails['start_date'];
|
||||
$end_date = $bookingDetails['end_date'];
|
||||
|
||||
$productQuery = "SELECT hotel_room.hotel_id, hotel_room.price, hotel_room_type.room_type_image, hotel.name, hotel_room_type.room_type_name FROM hotel_room JOIN hotel ON (hotel_room.hotel_id = hotel.hotel_id) JOIN hotel_room_type ON (hotel_room.room_type_id = hotel_room_type.room_type_id) WHERE hotel_room_id = " . $bookingDetails['hotel_room_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['price'];
|
||||
$img = $productDetails['room_type_image'];
|
||||
$name = $productDetails['name'] . " - " . $productDetails['room_type_name'];
|
||||
|
||||
break;
|
||||
case '2':
|
||||
$bookingQuery = "SELECT * FROM restaurant_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['restaurant_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT name, fee, restaurant_style.restaurant_style_image FROM restaurant JOIN restaurant_style ON (restaurant.restaurant_style_id = restaurant_style.restaurant_style_id) WHERE restaurant_id = " . $bookingDetails['restaurant_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = $productDetails['restaurant_style_image'];
|
||||
$name = $productDetails['name'];
|
||||
|
||||
break;
|
||||
case '3':
|
||||
$bookingQuery = "SELECT * FROM attraction_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['attraction_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT name, price, attraction_type.attraction_type_image FROM attraction JOIN attraction_type ON (attraction.attraction_type_id = attraction_type.attraction_type_id) WHERE attraction_id = " . $bookingDetails['attraction_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['price'];
|
||||
$img = $productDetails['attraction_type_image'];
|
||||
$name = $productDetails['name'];
|
||||
|
||||
break;
|
||||
case '4':
|
||||
$bookingQuery = "SELECT * FROM guide_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['guide_id'];
|
||||
$start_date = $bookingDetails['start_date'];
|
||||
$end_date = $bookingDetails['end_date'];
|
||||
|
||||
$productQuery = "SELECT user_guide.username, user_guide.fee, user_guide.avatar FROM user_guide WHERE u_id = " . $bookingDetails['guide_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = $productDetails['avatar'];
|
||||
$name = $productDetails['username'];
|
||||
|
||||
break;
|
||||
case '5':
|
||||
$bookingQuery = "SELECT * FROM transport_flight_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['flight_class_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT transport_flight_class.flight_id, transport_flight_class.class, transport_flight_class.fee, transport_flight.flight_code, transport_flight.takeoff_time, transport_flight.landing_time FROM transport_flight_class JOIN transport_flight ON (transport_flight.flight_id = transport_flight_class.flight_id) WHERE flight_class_id = " . $bookingDetails['flight_class_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = '';
|
||||
$name = $productDetails['flight_code'] . " - " . $productDetails['class'];
|
||||
|
||||
break;
|
||||
case '6':
|
||||
$bookingQuery = "SELECT * FROM transport_railway_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['railway_class_id'];
|
||||
$visit_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT transport_railway_class.train_id, transport_railway_class.class, transport_railway_class.fee, transport_railway.train_code, transport_railway.start_time, transport_railway.arrive_time FROM transport_railway_class JOIN transport_railway ON (transport_railway.train_id = transport_railway_class.train_id) WHERE train_seat_id = " . $id;
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = '';
|
||||
$name = $productDetails['train_code'] . " - " . $productDetails['class'];
|
||||
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
continue 2; // Skip to the next cart booking
|
||||
}
|
||||
|
||||
//unit price
|
||||
$unitprice = $cartBooking['subtotal_price'];
|
||||
|
||||
//choose
|
||||
$choose = $cartBooking['choose'];
|
||||
|
||||
//display
|
||||
echo '<table id="items" style="border:none;">';
|
||||
echo '<tr>';
|
||||
echo '<td width="15%">';
|
||||
|
||||
if ($img != ''){
|
||||
echo '<img src="data:image/jpeg;base64,' . base64_encode($img) . '" title="' . $id . '" id="' . $id . '" onclick="details(this)">';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
//name
|
||||
echo '<td width="20%">';
|
||||
echo '<h4 style="margin: 0%; font-size: large;">' . $name . '</h4>';
|
||||
echo '</td>';
|
||||
|
||||
if($end_date != null){
|
||||
//start date
|
||||
echo '<td width="10%">';
|
||||
echo '<p style="font-size: large;">'.$start_date.'</p>';
|
||||
echo '</td>';
|
||||
//start date
|
||||
echo '<td width="10%">';
|
||||
echo '<p style="font-size: large;">'.$end_date.'</p>';
|
||||
echo '</td>';
|
||||
}
|
||||
else{
|
||||
//start date
|
||||
echo '<td width="20%">';
|
||||
echo '<p style="font-size: large;">'.$start_date.'</p>';
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
//unit price
|
||||
echo '<td width="10%">';
|
||||
echo '<p style="font-size: large;">¥'.$unitprice.'</p>';
|
||||
echo '</td>';
|
||||
//add
|
||||
echo '<td width="6%" id="icon">';
|
||||
echo '<img src="../../../icon/add.svg" id="' . $booking_id . '" name="'. $cartBooking['booking_type_id'] .'" onclick="item_add(this)">';
|
||||
echo '</td>';
|
||||
//modify
|
||||
echo '<td width="8%">';
|
||||
echo '<input type="text" style="margin: 0%; font-size: large;" name="'. $cartBooking['booking_type_id'] .'" id="' . $booking_id . '" value="' . $quantity . '" onfocusout="item_modify(this)">';
|
||||
echo '</td>';
|
||||
//subtract
|
||||
echo '<td width="6%" id="icon">';
|
||||
echo '<img src="../../../icon/subtract.svg" id="' . $booking_id . '" name="'. $cartBooking['booking_type_id'] .'" onclick="item_subtract(this)">';
|
||||
echo '</td>';
|
||||
//delete
|
||||
echo '<td width="6%" id="icon">';
|
||||
echo '<img src="../../../icon/delete.svg" id="' . $booking_id . '" name="'. $cartBooking['booking_type_id'] .'" onclick="item_del(this)">';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
$cart_total_Query = "SELECT cart_total_price FROM user_buyer WHERE u_id = " . $u_id;
|
||||
$cart_total_Result = mysqli_query($conn, $cart_total_Query);
|
||||
$cart_total_price = mysqli_fetch_assoc($cart_total_Result);
|
||||
$total = $cart_total_price['cart_total_price'];
|
||||
|
||||
if($num_rows != 0){
|
||||
echo '<table width="20%" style="text-align: center; border:none; background-color: transparent;">';
|
||||
echo '<tr>';
|
||||
echo '<td><h1>Total Price: ¥ '.$total.'</h1></td>';
|
||||
echo '<td>';
|
||||
echo '<form action="./checkup.php">';
|
||||
echo '<button type="submit">Check up</button>';
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
else{
|
||||
echo '<h1>Nothing Here</h1>';
|
||||
echo '<br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<img src="../../../icon/favicon/logo_white.svg" alt="RoamEase" width="300px">
|
||||
<div style="margin: 20px 0;">
|
||||
<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>
|
||||
<p>© 2023 COMP3013 Group10. All rights reserved.</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
295
indexes/user/process/checkup.php
Normal file
295
indexes/user/process/checkup.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Cart</title>
|
||||
<script src="iframe.js"></script>
|
||||
<script src="./item_modify.js"></script>
|
||||
<link rel="stylesheet" href="./cart.css" type="text/css" />
|
||||
<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">
|
||||
</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['usertype']) && !$_SESSION['usertype'] === 'buyer'){
|
||||
header('Location: ../../../index.php');
|
||||
}
|
||||
}
|
||||
else{
|
||||
header('Location: ../../../index.php');
|
||||
}
|
||||
$u_id = $_SESSION['uid'];
|
||||
?>
|
||||
|
||||
<header>
|
||||
<div class="logo">
|
||||
<a href="../../../index.php"><img src="../../../icon/favicon/logo_white.svg" alt="RoamEase"></a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<?php
|
||||
if (isset($_SESSION['loggedin'])) {
|
||||
echo '<a href="./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">
|
||||
<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>
|
||||
|
||||
<div id="grid">
|
||||
|
||||
<?php
|
||||
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
$sql_cart_bookings = "SELECT * FROM cart_bookings WHERE u_id='$u_id' AND choose = '1'";
|
||||
$result_cart_bookings = mysqli_query($conn, $sql_cart_bookings);
|
||||
$num_rows = mysqli_num_rows($result_cart_bookings);
|
||||
|
||||
while ($cartBooking = mysqli_fetch_assoc($result_cart_bookings)) {
|
||||
$booking_id = $cartBooking['booking_id'];
|
||||
// Use a switch statement for different booking types
|
||||
switch ($cartBooking['booking_type_id']) {
|
||||
case '1':
|
||||
$bookingQuery = "SELECT * FROM hotel_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['hotel_room_id'];
|
||||
$start_date = $bookingDetails['start_date'];
|
||||
$end_date = $bookingDetails['end_date'];
|
||||
|
||||
$productQuery = "SELECT hotel_room.hotel_id, hotel_room.price, hotel_room_type.room_type_image, hotel.name, hotel_room_type.room_type_name FROM hotel_room JOIN hotel ON (hotel_room.hotel_id = hotel.hotel_id) JOIN hotel_room_type ON (hotel_room.room_type_id = hotel_room_type.room_type_id) WHERE hotel_room_id = " . $bookingDetails['hotel_room_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['price'];
|
||||
$img = $productDetails['room_type_image'];
|
||||
$name = $productDetails['name'] . " - " . $productDetails['room_type_name'];
|
||||
|
||||
break;
|
||||
case '2':
|
||||
$bookingQuery = "SELECT * FROM restaurant_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['restaurant_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT name, fee, restaurant_style.restaurant_style_image FROM restaurant JOIN restaurant_style ON (restaurant.restaurant_style_id = restaurant_style.restaurant_style_id) WHERE restaurant_id = " . $bookingDetails['restaurant_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = $productDetails['restaurant_style_image'];
|
||||
$name = $productDetails['name'];
|
||||
|
||||
break;
|
||||
case '3':
|
||||
$bookingQuery = "SELECT * FROM attraction_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['attraction_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT name, price, attraction_type.attraction_type_image FROM attraction JOIN attraction_type ON (attraction.attraction_type_id = attraction_type.attraction_type_id) WHERE attraction_id = " . $bookingDetails['attraction_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['price'];
|
||||
$img = $productDetails['attraction_type_image'];
|
||||
$name = $productDetails['name'];
|
||||
|
||||
break;
|
||||
case '4':
|
||||
$bookingQuery = "SELECT * FROM guide_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['guide_id'];
|
||||
$start_date = $bookingDetails['start_date'];
|
||||
$end_date = $bookingDetails['end_date'];
|
||||
|
||||
$productQuery = "SELECT user_guide.username, user_guide.fee, user_guide.avatar FROM user_guide WHERE u_id = " . $bookingDetails['guide_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = $productDetails['avatar'];
|
||||
$name = $productDetails['username'];
|
||||
|
||||
break;
|
||||
case '5':
|
||||
$bookingQuery = "SELECT * FROM transport_flight_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['flight_class_id'];
|
||||
$start_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT transport_flight_class.flight_id, transport_flight_class.class, transport_flight_class.fee, transport_flight.flight_code, transport_flight.takeoff_time, transport_flight.landing_time FROM transport_flight_class JOIN transport_flight ON (transport_flight.flight_id = transport_flight_class.flight_id) WHERE flight_class_id = " . $bookingDetails['flight_class_id'];
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = '';
|
||||
$name = $productDetails['flight_code'] . " - " . $productDetails['class'];
|
||||
|
||||
break;
|
||||
case '6':
|
||||
$bookingQuery = "SELECT * FROM transport_railway_booking WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
$bookingDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$quantity = $bookingDetails['quantity'];
|
||||
$id = $bookingDetails['railway_class_id'];
|
||||
$visit_date = $bookingDetails['visit_date'];
|
||||
$end_date = null;
|
||||
|
||||
$productQuery = "SELECT transport_railway_class.train_id, transport_railway_class.class, transport_railway_class.fee, transport_railway.train_code, transport_railway.start_time, transport_railway.arrive_time FROM transport_railway_class JOIN transport_railway ON (transport_railway.train_id = transport_railway_class.train_id) WHERE train_seat_id = " . $id;
|
||||
$bookingResult = mysqli_query($conn, $productQuery);
|
||||
$productDetails = mysqli_fetch_assoc($bookingResult);
|
||||
|
||||
$price = $productDetails['fee'];
|
||||
$img = '';
|
||||
$name = $productDetails['train_code'] . " - " . $productDetails['class'];
|
||||
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
continue 2; // Skip to the next cart booking
|
||||
}
|
||||
|
||||
//unit price
|
||||
$unitprice = $cartBooking['subtotal_price'];
|
||||
|
||||
//choose
|
||||
$choose = $cartBooking['choose'];
|
||||
|
||||
//display
|
||||
echo '<table id="items" style="border:none;">';
|
||||
echo '<tr>';
|
||||
echo '<td width="15%">';
|
||||
|
||||
if ($img != ''){
|
||||
echo '<img src="data:image/jpeg;base64,' . base64_encode($img) . '" title="' . $id . '" id="' . $id . '" onclick="details(this)">';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
//name
|
||||
echo '<td width="20%">';
|
||||
echo '<h4 style="margin: 0%; font-size: large;">' . $name . '</h4>';
|
||||
echo '</td>';
|
||||
|
||||
if($end_date != null){
|
||||
//start date
|
||||
echo '<td width="15%">';
|
||||
echo '<p style="font-size: large;">'.$start_date.'</p>';
|
||||
echo '</td>';
|
||||
//start date
|
||||
echo '<td width="15%">';
|
||||
echo '<p style="font-size: large;">'.$end_date.'</p>';
|
||||
echo '</td>';
|
||||
}
|
||||
else{
|
||||
//start date
|
||||
echo '<td width="30%">';
|
||||
echo '<p style="font-size: large;">'.$start_date.'</p>';
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
//unit price
|
||||
echo '<td width="15%">';
|
||||
echo '<p style="font-size: large;">¥'.$unitprice.'</p>';
|
||||
echo '</td>';
|
||||
|
||||
//quantity
|
||||
echo '<td width="20%">';
|
||||
echo '<p style="margin: 0%; font-size: large;" name="'. $cartBooking['booking_type_id'] .'" id="' . $booking_id . '" value="' . $quantity . '">x' . $quantity . '</p>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
$cart_total_Query = "SELECT cart_total_price FROM user_buyer WHERE u_id = " . $u_id;
|
||||
$cart_total_Result = mysqli_query($conn, $cart_total_Query);
|
||||
$cart_total_price = mysqli_fetch_assoc($cart_total_Result);
|
||||
$total = $cart_total_price['cart_total_price'];
|
||||
|
||||
if($num_rows != 0){
|
||||
echo '<table width="20%" style="text-align: center; border:none; background-color: transparent;">';
|
||||
echo '<tr>';
|
||||
echo '<td><h1>Total Price: ¥ '.$total.'</h1></td>';
|
||||
echo '<td>';
|
||||
echo '<form action="./order.php" method="post">';
|
||||
echo '<input type="hidden" name="total" value="'.$total.'">';
|
||||
echo '<button type="submit">Order</button>';
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
else{
|
||||
echo '<h1>Nothing Here</h1>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<img src="../../../icon/favicon/logo_white.svg" alt="RoamEase" width="300px">
|
||||
<div style="margin: 20px 0;">
|
||||
<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>
|
||||
<p>© 2023 COMP3013 Group10. All rights reserved.</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
45
indexes/user/process/iframe.js
Normal file
45
indexes/user/process/iframe.js
Normal file
@@ -0,0 +1,45 @@
|
||||
function details(tag){
|
||||
var name = tag.id;
|
||||
makeIFrame('./item_details.php?myParam=' + name);
|
||||
}
|
||||
|
||||
function makeIFrame(url) {
|
||||
var existence = document.getElementById("detail_window");
|
||||
if (!existence) {
|
||||
// Create the overlay div and add it to the page
|
||||
var overlay = document.createElement("div");
|
||||
overlay.id = "overlay";
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
// Create the iframe and add it to the overlay div
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("src", url);
|
||||
iframe.id = "detail_window";
|
||||
overlay.appendChild(iframe);
|
||||
|
||||
// Create the close button and add it to the overlay div
|
||||
var closeButton = document.createElement("button");
|
||||
closeButton.innerHTML = "x";
|
||||
closeButton.title = "Close";
|
||||
closeButton.id = "closebutton";
|
||||
overlay.appendChild(closeButton);
|
||||
|
||||
// Add event listener to close the iframe when the close button is clicked
|
||||
closeButton.addEventListener("click", closeIFrame);
|
||||
|
||||
// Add event listener to close the iframe when clicked outside
|
||||
setTimeout(function() {
|
||||
overlay.addEventListener("click", closeIFrame);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to close the iframe and remove the overlay div from the page
|
||||
function closeIFrame() {
|
||||
var overlay = document.getElementById("overlay");
|
||||
if (overlay) {
|
||||
overlay.removeEventListener("click", closeIFrame);
|
||||
overlay.parentNode.removeChild(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
101
indexes/user/process/index_.php
Normal file
101
indexes/user/process/index_.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Online Fruit Store</title>
|
||||
<script src="./iframe.js"></script>
|
||||
<link rel="stylesheet" href="./show_item.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<br><br><br><br><br><br><br>
|
||||
|
||||
<div id="grid">
|
||||
<?php
|
||||
include '../ConnectDB.php';
|
||||
session_start();
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
$usertype = $_SESSION['user_type'];
|
||||
if($usertype == "seller"){
|
||||
$a = "seller_availability";
|
||||
$p = "seller_price";
|
||||
}
|
||||
else{
|
||||
$a = "buyer_availability";
|
||||
$p = "buyer_price";
|
||||
}
|
||||
|
||||
//check availability
|
||||
$sql_rownum="SELECT * FROM inventory WHERE $a='1'";
|
||||
$res = mysqli_query($conn, $sql_rownum);
|
||||
if (!$res) {
|
||||
die('Query failed: ' . mysqli_error($conn));
|
||||
}
|
||||
$row = mysqli_num_rows($res);
|
||||
|
||||
//read in and display
|
||||
for ($i = 0; $i < $row; $i++) {
|
||||
while ($goods = mysqli_fetch_array($res)){
|
||||
//if inventory == 0, hide it from buyer
|
||||
if($goods['quantities'] != 0 || $usertype == "seller"){
|
||||
echo '<div id="items">';
|
||||
if (!empty($goods['imgname'])) {
|
||||
$imagePath = "../../img/" . $goods['imgname'];
|
||||
if (file_exists($imagePath)) {
|
||||
echo '<img src="' . $imagePath . '" title="' . $goods['name'] . '" id="' . $goods['name'] . '" onmousedown="details(this)">';
|
||||
}
|
||||
} else {
|
||||
echo '<img src="data:image/jpeg;base64,' . base64_encode($goods['img']) . '" title="' . $goods['name'] . '" id="' . $goods['name'] . '" onmousedown="details(this)">';
|
||||
}
|
||||
echo '<h5 style="margin: 0%; margin-bottom: 3%; margin-top: 3%; font-size: 70%;" id="' . $goods['name'] . '" onclick="details(this)">' . $goods['name'] . '</h5>';
|
||||
echo '<p style="font-size: small; margin: 0%;" id="' . $goods['name'] . '" onclick="details(this)">' . $goods['simpledesc'] . '</p>';
|
||||
echo '<p style="font-size: small; margin: 0%; color: blue;" id="' . $goods['name'] . '" onclick="details(this)">¥' . $goods[$p] . '/kg</p>';
|
||||
echo '<img class="icon_1" src="../../icon/addcart.svg" title="add to cart" id="' . $goods['name'] . '" onclick="addcart(this)">';
|
||||
echo '<img class="icon_2" src="../../icon/checkout.svg" title="buy now" id="' . $goods['name'] . '" onclick="buynow(this)">';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!--dialog for adding fruit-->
|
||||
<dialog class="dialog">
|
||||
<form method="dialog">
|
||||
Add <input type="number" id="amount" value="1" placeholder="how many"> kg
|
||||
<br><br>
|
||||
<button class="dialogbutton" type="submit" value="add cart">Check</button>
|
||||
<button class="dialogbutton" id="cancel-button">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<script>
|
||||
function addcart(tag){
|
||||
var name = tag.id;
|
||||
var dialog = document.querySelector('dialog');
|
||||
dialog.showModal();
|
||||
dialog.addEventListener('close', function(event) {
|
||||
var amount = document.getElementById("amount").value;
|
||||
var targetButton = event.target.returnValue;
|
||||
if (targetButton === "add cart" && amount !== "") {
|
||||
window.location.href = "addcart.php?name=" + name + "&quantity=" + amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buynow(tag){
|
||||
var name = tag.id;
|
||||
var dialog = document.querySelector('dialog');
|
||||
dialog.showModal();
|
||||
dialog.addEventListener('close', function(event) {
|
||||
var amount = document.getElementById("amount").value;
|
||||
var targetButton = event.target.returnValue;
|
||||
if (targetButton === "add cart" && amount !== "") {
|
||||
window.location.href = "checkup_now.php?name=" + name + "&quantity=" + amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
indexes/user/process/interfaces/failed.php
Normal file
25
indexes/user/process/interfaces/failed.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Error Occurred</title>
|
||||
<link rel="stylesheet" href="./instruct.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="area">
|
||||
<img src="../../../../icon/close.svg">
|
||||
<h2 style="margin: none; padding: none;">Oops!</h2>
|
||||
<?php
|
||||
if(isset($_GET["why"])) {
|
||||
echo "<h1>".$_GET["why"]."</h1>";
|
||||
}
|
||||
else{
|
||||
echo "<h1>The order closed due to some error!</h1>";
|
||||
}
|
||||
?>
|
||||
<a href='../cart_index.php' style="text-decoration: none;">Try again</a>
|
||||
<script type='text/javascript'>
|
||||
setTimeout(function() {window.top.location.href = '../cart.php';}, 500);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
17
indexes/user/process/interfaces/instruct.css
Normal file
17
indexes/user/process/interfaces/instruct.css
Normal file
@@ -0,0 +1,17 @@
|
||||
#area{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 300px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
user-select: none;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
img{
|
||||
width: 45%;
|
||||
height: 45%;
|
||||
margin: none;
|
||||
}
|
||||
16
indexes/user/process/interfaces/success.php
Normal file
16
indexes/user/process/interfaces/success.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Success</title>
|
||||
<link rel="stylesheet" href="./instruct.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="area">
|
||||
<img src="../../../../icon/check.svg">
|
||||
<h1>Success</h1>
|
||||
<script type='text/javascript'>
|
||||
setTimeout(function() {window.top.location.href = '../../../../index.php';}, 500);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
165
indexes/user/process/item_details.php
Normal file
165
indexes/user/process/item_details.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="./iframe.js"></script>
|
||||
<link rel="stylesheet" href="./show_item.css" type="text/css" />
|
||||
<style>
|
||||
#area{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 95%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
user-select: none;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
img{
|
||||
border-radius: 12px;
|
||||
margin-top: 2.5%;
|
||||
width: 65%;
|
||||
height: 65%;
|
||||
overflow:hidden;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
-webkit-background-size:cover;
|
||||
-moz-background-size:cover;
|
||||
background-size:cover;
|
||||
transition: 0.5s;
|
||||
}
|
||||
img:hover{
|
||||
border-radius: 12px;
|
||||
margin-top: 2.5%;
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
overflow:hidden;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
-webkit-background-size:cover;
|
||||
-moz-background-size:cover;
|
||||
background-size:cover;
|
||||
transition: 0.5s;
|
||||
}
|
||||
pre{
|
||||
white-space:pre-wrap;
|
||||
user-select: text;
|
||||
text-align: left;
|
||||
}
|
||||
.checkicon{
|
||||
width: 6%;
|
||||
height: 6%;
|
||||
}
|
||||
.checkicon:hover{
|
||||
width: 8%;
|
||||
height: 8%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!--dialog for adding fruit-->
|
||||
<dialog class="dialog">
|
||||
<form method="dialog">
|
||||
Add <input type="number" id="amount" value="1" placeholder="how many"> kg
|
||||
<br><br>
|
||||
<button class="dialogbutton" type="submit" value="add cart">Check</button>
|
||||
<button class="dialogbutton" id="cancel-button">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
|
||||
<script>
|
||||
// get the value of the 'myParam' query parameter from the URL
|
||||
var myParamValue = new URLSearchParams(window.location.search).get('myParam');
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
session_start();
|
||||
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
|
||||
if ($usertype == "seller") {
|
||||
$p = "seller_price";
|
||||
} else {
|
||||
$p = "buyer_price";
|
||||
}
|
||||
if (isset($_GET['myParam']) && !empty($_GET['myParam'])) {
|
||||
$sql = "SELECT * FROM inventory WHERE name = '" . $_GET['myParam'] . "'";
|
||||
$res = mysqli_query($conn, $sql);
|
||||
$goods = mysqli_fetch_assoc($res);
|
||||
|
||||
if (!empty($goods['imgname'])) {
|
||||
$imagePath = "../../img/" . $goods['imgname'];
|
||||
|
||||
if (file_exists($imagePath)) {
|
||||
$image = $imagePath;
|
||||
}
|
||||
} else {
|
||||
$image = 'data:image/jpeg;base64,' . base64_encode($goods['img']);
|
||||
}
|
||||
} else {
|
||||
// Handle the case when myParam is not set or is empty
|
||||
$image = "../../img/default_image_path.jpg";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="area">
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%" style="text-align: right;">
|
||||
<img src="<?php echo $image; ?>" title="<?php echo $goods['name']; ?>">
|
||||
</td>
|
||||
<td width="50%">
|
||||
<h1><?php echo $goods['name']; ?></h1>
|
||||
<h3><?php echo $goods['simpledesc']; ?></h3>
|
||||
<h4 style="color: blue;">Inventory: <?php echo $goods['quantities']; ?>kg        Price: ¥<?php echo $goods[$p]; ?>/kg</h4>
|
||||
<?php
|
||||
if ($usertype == "seller" || $usertype == "buyer") {
|
||||
echo "<img class='checkicon' src='../../icon/addcart.svg' title='add to cart' id='". $goods['name']."' onclick='addcart(this)'>";
|
||||
echo "<img class='checkicon' src='../../icon/checkout.svg' title='buy now' id='".$goods['name']."' onclick='buynow(this)'>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<pre>
|
||||
<?php echo $goods['fulldesc']; ?>
|
||||
</pre>
|
||||
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function addcart(tag){
|
||||
var name = tag.id;
|
||||
var dialog = document.querySelector('dialog');
|
||||
dialog.showModal();
|
||||
dialog.addEventListener('close', function(event) {
|
||||
var amount = document.getElementById("amount").value;
|
||||
var targetButton = event.target.returnValue;
|
||||
if (targetButton === "add cart" && amount !== "") {
|
||||
window.location.href = "addcart.php?name=" + name + "&quantity=" + amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buynow(tag){
|
||||
var name = tag.id;
|
||||
var dialog = document.querySelector('dialog');
|
||||
dialog.showModal();
|
||||
dialog.addEventListener('close', function(event) {
|
||||
var amount = document.getElementById("amount").value;
|
||||
var targetButton = event.target.returnValue;
|
||||
if (targetButton === "add cart" && amount !== "") {
|
||||
window.location.href = "checkup_now.php?name=" + name + "&quantity=" + amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
24
indexes/user/process/item_modify.js
Normal file
24
indexes/user/process/item_modify.js
Normal file
@@ -0,0 +1,24 @@
|
||||
function item_add(tag){
|
||||
var id = tag.id;
|
||||
var table = tag.name;
|
||||
window.location.href = "./modify/item_add.php?booking_id=" + id + "&table=" + table;
|
||||
}
|
||||
|
||||
function item_subtract(tag){
|
||||
var id = tag.id;
|
||||
var table = tag.name;
|
||||
window.location.href = "./modify/item_subtract.php?booking_id=" + id + "&table=" + table;
|
||||
}
|
||||
|
||||
function item_del(tag){
|
||||
var id = tag.id;
|
||||
var table = tag.name;
|
||||
window.location.href = "./modify/item_del.php?booking_id=" + id + "&table=" + table;
|
||||
}
|
||||
|
||||
function item_modify(tag){
|
||||
var id = tag.id;
|
||||
var quantity = tag.value;
|
||||
var table = tag.name;
|
||||
window.location.href = "./modify/item_modify.php?booking_id=" + id + "&quantity=" + quantity + "&table=" + table;
|
||||
}
|
||||
62
indexes/user/process/modify/item_add.php
Normal file
62
indexes/user/process/modify/item_add.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
include "../../../ConnectDB.php";
|
||||
|
||||
session_start();
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
if (isset($_GET["booking_id"]) && isset($_GET["table"])) {
|
||||
$booking_id = $_GET["booking_id"];
|
||||
|
||||
switch ($_GET["table"]) {
|
||||
case '1':
|
||||
$table = "hotel_booking";
|
||||
break;
|
||||
case '2':
|
||||
$table = "restaurant_booking";
|
||||
break;
|
||||
case '3':
|
||||
$table = "attraction_booking";
|
||||
break;
|
||||
case '4':
|
||||
$table = "guide_booking";
|
||||
break;
|
||||
case '5':
|
||||
$table = "transport_flight_booking";
|
||||
break;
|
||||
case '6':
|
||||
$table = "transport_railway_booking";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
}
|
||||
|
||||
$price_query = "SELECT `subtotal_price` FROM cart_bookings WHERE booking_id=" . $booking_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["subtotal_price"];
|
||||
|
||||
$quantity_query = "SELECT quantity FROM `$table` WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $quantity_query);
|
||||
$quantity = mysqli_fetch_assoc($res);
|
||||
$quantity = $quantity['quantity'];
|
||||
|
||||
$add = "UPDATE `$table` SET quantity = '$quantity' + 1 WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $add);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
|
||||
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price + '$price' WHERE u_id='$uid'";
|
||||
$res = mysqli_query($conn, $total);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header('Location: ../cart.php');
|
||||
?>
|
||||
65
indexes/user/process/modify/item_del.php
Normal file
65
indexes/user/process/modify/item_del.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
include "../../../ConnectDB.php";
|
||||
|
||||
session_start();
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
if (isset($_GET["booking_id"]) && isset($_GET["table"])) {
|
||||
$booking_id = mysqli_real_escape_string($conn, $_GET["booking_id"]);
|
||||
|
||||
switch ($_GET["table"]) {
|
||||
case '1':
|
||||
$table = "hotel_booking";
|
||||
break;
|
||||
case '2':
|
||||
$table = "restaurant_booking";
|
||||
break;
|
||||
case '3':
|
||||
$table = "attraction_booking";
|
||||
break;
|
||||
case '4':
|
||||
$table = "guide_booking";
|
||||
break;
|
||||
case '5':
|
||||
$table = "transport_flight_booking";
|
||||
break;
|
||||
case '6':
|
||||
$table = "transport_railway_booking";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
}
|
||||
|
||||
$subtotal_price = "SELECT subtotal_price FROM cart_bookings WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $subtotal_price);
|
||||
$subtotal_price = mysqli_fetch_assoc($res);
|
||||
$subtotal_price = $subtotal_price['subtotal_price'];
|
||||
|
||||
$quantity_query = "SELECT quantity FROM `$table` WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $quantity_query);
|
||||
$quantity = mysqli_fetch_assoc($res);
|
||||
$quantity = $quantity['quantity'];
|
||||
|
||||
$delete_query = "DELETE FROM bookings WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $delete_query);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
} else {
|
||||
header('Location: ../cart.php'); // Redirect after successful deletion
|
||||
}
|
||||
|
||||
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price - ('$subtotal_price' * '$quantity') WHERE u_id='$uid'";
|
||||
$res = mysqli_query($conn, $total);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
header('Location: ../cart.php'); // Redirect if booking_id is not set
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
68
indexes/user/process/modify/item_modify.php
Normal file
68
indexes/user/process/modify/item_modify.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
include "../../../ConnectDB.php";
|
||||
|
||||
session_start();
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
if (isset($_GET["booking_id"]) && isset($_GET["table"]) && isset($_GET["quantity"])) {
|
||||
|
||||
$booking_id = $_GET["booking_id"];
|
||||
$quantity = $_GET["quantity"];
|
||||
if($quantity > 0){
|
||||
|
||||
switch ($_GET["table"]) {
|
||||
case '1':
|
||||
$table = "hotel_booking";
|
||||
break;
|
||||
case '2':
|
||||
$table = "restaurant_booking";
|
||||
break;
|
||||
case '3':
|
||||
$table = "attraction_booking";
|
||||
break;
|
||||
case '4':
|
||||
$table = "guide_booking";
|
||||
break;
|
||||
case '5':
|
||||
$table = "transport_flight_booking";
|
||||
break;
|
||||
case '6':
|
||||
$table = "transport_railway_booking";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
exit();
|
||||
}
|
||||
|
||||
$quantity_query = "SELECT quantity FROM `$table` WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $quantity_query);
|
||||
$old_quantity = mysqli_fetch_assoc($res);
|
||||
$old_quantity = $old_quantity['quantity'];
|
||||
|
||||
$price_query = "SELECT `subtotal_price` FROM cart_bookings WHERE booking_id=" . $booking_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["subtotal_price"];
|
||||
|
||||
$modified_price = $price * ($quantity - $old_quantity);
|
||||
|
||||
$add = "UPDATE `$table` SET quantity = '$quantity' WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $add);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
|
||||
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price + '$modified_price' WHERE u_id='$uid'";
|
||||
$res = mysqli_query($conn, $total);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: ../cart.php');
|
||||
?>
|
||||
69
indexes/user/process/modify/item_subtract.php
Normal file
69
indexes/user/process/modify/item_subtract.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
include "../../../ConnectDB.php";
|
||||
|
||||
session_start();
|
||||
$uid = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
if (isset($_GET["booking_id"]) && isset($_GET["table"])) {
|
||||
$booking_id = $_GET["booking_id"];
|
||||
|
||||
switch ($_GET["table"]) {
|
||||
case '1':
|
||||
$table = "hotel_booking";
|
||||
break;
|
||||
case '2':
|
||||
$table = "restaurant_booking";
|
||||
break;
|
||||
case '3':
|
||||
$table = "attraction_booking";
|
||||
break;
|
||||
case '4':
|
||||
$table = "guide_booking";
|
||||
break;
|
||||
case '5':
|
||||
$table = "transport_flight_booking";
|
||||
break;
|
||||
case '6':
|
||||
$table = "transport_railway_booking";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
}
|
||||
|
||||
$price_query = "SELECT `subtotal_price` FROM cart_bookings WHERE booking_id=" . $booking_id;
|
||||
$priceRes = mysqli_query($conn, $price_query);
|
||||
$price = mysqli_fetch_assoc($priceRes);
|
||||
$price = $price["subtotal_price"];
|
||||
|
||||
$quantity_query = "SELECT quantity FROM `$table` WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $quantity_query);
|
||||
$quantity = mysqli_fetch_assoc($res);
|
||||
$quantity = $quantity['quantity'];
|
||||
|
||||
if($quantity > 1){
|
||||
$add = "UPDATE `$table` SET quantity = '$quantity' - 1 WHERE booking_id='$booking_id'";
|
||||
$res = mysqli_query($conn, $add);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
|
||||
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price - '$price' WHERE u_id='$uid'";
|
||||
$res = mysqli_query($conn, $total);
|
||||
if (!$res) {
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Error occurred!');
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo "<script type='text/javascript'>
|
||||
alert('You cannot buy 0 quantity!');
|
||||
</script>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header('Location: ../cart.php');
|
||||
?>
|
||||
173
indexes/user/process/order.php
Normal file
173
indexes/user/process/order.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
|
||||
// Start the session
|
||||
session_start();
|
||||
|
||||
// Escape the username and user type for security
|
||||
$u_id = mysqli_real_escape_string($conn, $_SESSION['uid']);
|
||||
|
||||
// Retrieve the total price
|
||||
$total_price = $_POST['total'];
|
||||
|
||||
// If buyer do not have enough balance
|
||||
$sql_check_balance = "SELECT balance FROM user_buyer WHERE u_id = '$u_id'";
|
||||
$res = mysqli_query($conn, $sql_check_balance);
|
||||
$balance = mysqli_fetch_array($res);
|
||||
if($balance['balance'] < $total_price){
|
||||
echo "<script type='text/javascript'>
|
||||
window.location.href = './interfaces/failed.php?why=Insufficient Balance';
|
||||
</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$new_receipt_query = "INSERT INTO `receipt` (`u_id`, `total_price`) VALUES ('$u_id', '$total_price')";
|
||||
$new_receipt_set = mysqli_query($conn, $new_receipt_query);
|
||||
$receipt_id = mysqli_insert_id($conn);
|
||||
|
||||
// Update information
|
||||
$sql_cart_bookings = "SELECT * FROM cart_bookings WHERE u_id='$u_id' AND choose = '1'";
|
||||
$result_cart_bookings = mysqli_query($conn, $sql_cart_bookings);
|
||||
$num_rows = mysqli_num_rows($result_cart_bookings);
|
||||
|
||||
while ($cartBooking = mysqli_fetch_assoc($result_cart_bookings)) {
|
||||
$booking_id = $cartBooking['booking_id'];
|
||||
$booking_type_id = $cartBooking['booking_type_id'];
|
||||
$subtotal_price = $cartBooking['subtotal_price'];
|
||||
// Use a switch statement for different booking types
|
||||
switch ($booking_type_id) {
|
||||
case '1':
|
||||
$bookingQuery = "UPDATE `hotel_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT hotel_booking.quantity, seller_id FROM hotel_booking JOIN hotel_room ON (hotel_room.hotel_room_id = hotel_booking.hotel_room_id) JOIN hotel ON (hotel.hotel_id = hotel_room.hotel_id) WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $sellerResult['seller_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "UPDATE `user_seller` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','1','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
case '2':
|
||||
$bookingQuery = "UPDATE `restaurant_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT restaurant_booking.quantity, seller_id FROM restaurant_booking JOIN restaurant ON (restaurant_booking.restaurant_id = restaurant.restaurant_id) WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $sellerResult['seller_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "UPDATE `user_seller` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','2','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
case '3':
|
||||
$bookingQuery = "UPDATE `attraction_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT attraction_booking.quantity, seller_id FROM attraction_booking JOIN attraction ON (attraction_booking.attraction_id = attraction.attraction_id) WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $sellerResult['seller_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "UPDATE `user_seller` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','3','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
case '4':
|
||||
$bookingQuery = "UPDATE `guide_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT guide_booking.quantity, guide_id FROM guide_booking WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $sellerResult['guide_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "UPDATE `user_guide` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','4','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
case '5':
|
||||
$bookingQuery = "UPDATE `transport_flight_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT transport_flight_booking.quantity, airline_id FROM transport_flight_booking JOIN transport_flight_class ON (transport_flight_booking.flight_class_id = transport_flight_class.flight_class_id) JOIN transport_flight ON (transport_flight.flight_id = transport_flight_class.flight_id) WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$airline_id = $sellerResult['airline_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "SELECT seller_id FROM transport_airline WHERE airline_id = " . $airline_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$seller_id = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $seller_id['seller_id'];
|
||||
|
||||
$sellerQuery = "UPDATE `user_seller` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','5','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
case '6':
|
||||
$bookingQuery = "UPDATE `transport_railway_booking` SET payment_status = '1' WHERE booking_id = " . $booking_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
$sellerQuery = "SELECT transport_railway_booking.quantity, seller_id FROM transport_railway_booking JOIN transport_railway_class ON (transport_railway_booking.railway_class_id = transport_railway_class.train_seat_id) JOIN transport_railway ON (transport_railway.train_id = transport_railway_class.train_id) WHERE booking_id = " . $booking_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
$sellerResult = mysqli_fetch_assoc($sellerResult);
|
||||
$seller_id = $sellerResult['seller_id'];
|
||||
$quantity = $sellerResult['quantity'];
|
||||
$sub_price = $quantity * $subtotal_price;
|
||||
|
||||
$sellerQuery = "UPDATE `user_seller` SET balance = balance + '$sub_price' WHERE u_id = " . $seller_id;
|
||||
$sellerResult = mysqli_query($conn, $sellerQuery);
|
||||
|
||||
$receiptQuery = "INSERT INTO `receipt_bookings`(`receipt_id`, `booking_id`, `booking_type_id`, `booking_status`, `subtotal_price`, `quantity`, `seller_id`) VALUES ('$receipt_id','$booking_id','6','Unused','$subtotal_price', '$quantity', '$seller_id')";
|
||||
$receiptResult = mysqli_query($conn, $receiptQuery);
|
||||
|
||||
break;
|
||||
default:
|
||||
echo "Unknown booking type";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Update cart
|
||||
$bookingQuery = "DELETE FROM `cart_bookings` WHERE u_id = '$u_id' AND choose = '1'";
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
// User balance
|
||||
$bookingQuery = "UPDATE `user_buyer` SET balance = balance - '$total_price', cart_total_price = '0' WHERE u_id = " . $u_id;
|
||||
$bookingResult = mysqli_query($conn, $bookingQuery);
|
||||
|
||||
if($bookingResult){
|
||||
header('Location: ./interfaces/success.php');
|
||||
}
|
||||
else{
|
||||
header('Location: ./interfaces/failed.php');
|
||||
}
|
||||
|
||||
?>
|
||||
85
indexes/user/process/receipt.php
Normal file
85
indexes/user/process/receipt.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
td{
|
||||
font-size: small;
|
||||
}
|
||||
th{
|
||||
font-size: small;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="./cart.css" type="text/css" />
|
||||
</head>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
include "../ConnectDB.php";
|
||||
|
||||
// Start the session
|
||||
session_start();
|
||||
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
|
||||
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
|
||||
if($usertype == "seller"){
|
||||
$r = "seller_receipt";
|
||||
}
|
||||
else{
|
||||
$r = "buyer_receipt";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $r WHERE name='$username'";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$row = mysqli_num_rows($result);
|
||||
|
||||
if($row <= 0){
|
||||
echo '<h3>Nothing Here</h3>';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div id="grid">';
|
||||
|
||||
for ($i = 0; $i < $row; $i++) {
|
||||
//get number of columns
|
||||
$fields = mysqli_num_fields($result);
|
||||
|
||||
//Get each row data
|
||||
while ($row_data = mysqli_fetch_array($result)){
|
||||
echo '<table id="items">';
|
||||
//display for each fruit
|
||||
echo '<tr>';
|
||||
echo '<th width="20%">Fruit</th>';
|
||||
echo '<th width="20%">Quantity (kg)</th>';
|
||||
echo '<th width="20%">Unit price (¥/kg)</th>';
|
||||
echo '<th width="20%">Retail price (¥)</th>';
|
||||
echo '</tr>';
|
||||
|
||||
//explode details messages to display
|
||||
$list = explode("|", $row_data['details']);
|
||||
for($index = 0; $index < count($list); $index++){
|
||||
if($index % 4 == 0){
|
||||
echo "<tr>";
|
||||
echo "<td>".$list[$index]."</td>";
|
||||
}
|
||||
else echo "<td>".$list[$index]."</td>";
|
||||
}
|
||||
|
||||
//display for total price and date
|
||||
echo '<tr style="color: blue;">';
|
||||
echo '<th></th>';
|
||||
echo '<th></th>';
|
||||
echo '<th>Date</th>';
|
||||
echo '<th>Total price</th>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr style="color: blue;">';
|
||||
echo '<th></th>';
|
||||
echo '<th></th>';
|
||||
echo "<td>".$row_data['date']."</td>";
|
||||
echo "<td>¥".$row_data['total']."</td>";
|
||||
echo '</tr>';
|
||||
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
202
indexes/user/process/show_item.css
Normal file
202
indexes/user/process/show_item.css
Normal file
@@ -0,0 +1,202 @@
|
||||
#grid{
|
||||
position:absolute;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-wrap: wrap;
|
||||
margin: none;
|
||||
border: none;
|
||||
width: 100%;
|
||||
left:1.5%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
}
|
||||
#items{
|
||||
display: block;
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
color: black;
|
||||
font-size: 200%;
|
||||
border-radius: 12px;
|
||||
backdrop-filter: blur(4px);
|
||||
margin: 3%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-style: rgb(10, 22, 44);
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
padding: 0.2%;
|
||||
width: 26vw;
|
||||
height: 30vw;
|
||||
transition: 0.3s;
|
||||
}
|
||||
img{
|
||||
border-radius: 12px;
|
||||
margin-top: 2.5%;
|
||||
width: 95%;
|
||||
height: 60%;
|
||||
overflow:hidden;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
-webkit-background-size:cover;
|
||||
-moz-background-size:cover;
|
||||
background-size:cover;
|
||||
cursor: hand;
|
||||
transition: 0.5s;
|
||||
}
|
||||
.icon_1{
|
||||
left: 40%;
|
||||
position: absolute;
|
||||
display: block;
|
||||
text-align: right;
|
||||
border-radius: 12%;
|
||||
width: 9%;
|
||||
height: 9%;
|
||||
margin: 1%;
|
||||
overflow:hidden;
|
||||
cursor: hand;
|
||||
}
|
||||
.icon_1:hover{
|
||||
width: 9%;
|
||||
height: 9%;
|
||||
}
|
||||
.icon_2{
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
display: block;
|
||||
text-align: right;
|
||||
border-radius: 12%;
|
||||
width: 9%;
|
||||
height: 9%;
|
||||
margin: 1%;
|
||||
overflow:hidden;
|
||||
cursor: hand;
|
||||
transition: 0.5s;
|
||||
}
|
||||
.icon_2:hover{
|
||||
width: 9%;
|
||||
height: 9%;
|
||||
}
|
||||
#items:hover{
|
||||
box-shadow: 0px 0px 10px rgb(106, 104, 104);
|
||||
}
|
||||
img:hover{
|
||||
margin-top: 0%;
|
||||
box-shadow: 0px 0px 10px rgb(106, 104, 104);
|
||||
width: 100%;
|
||||
height: 62%;
|
||||
}
|
||||
h5:hover{
|
||||
cursor: hand;
|
||||
}
|
||||
#detail_window{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
transform: scale(1.7);
|
||||
/* 垂直居中 */
|
||||
top: 10%;
|
||||
bottom: 0;
|
||||
height: 50%;
|
||||
/* 水平居中 */
|
||||
left: 0%;
|
||||
right: 0%;
|
||||
width: 57%;
|
||||
margin: auto;
|
||||
|
||||
user-select: none;
|
||||
background-color: rgba(239, 230, 230, 0.5);
|
||||
border: 0px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0px 0px 16px rgb(70, 69, 69);
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
#overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(109, 103, 103, 0.6);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 10000;
|
||||
}
|
||||
body{
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#closebutton{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
transform: scale(1.4);
|
||||
top: 14%;
|
||||
height: 2.2%;
|
||||
margin-left: 95%;
|
||||
width: 2.2%;
|
||||
font-size: 80%;
|
||||
user-select: none;
|
||||
border: 0px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0px 0px 16px rgb(142, 142, 142);
|
||||
}
|
||||
#closebutton:hover{
|
||||
background-color: red;
|
||||
}
|
||||
.dialog{
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
color: black;
|
||||
font-size: 150%;
|
||||
box-shadow: 0px 0px 10px rgb(106, 104, 104);
|
||||
border-radius: 12px;
|
||||
border: none;
|
||||
backdrop-filter: blur(20px);
|
||||
height: 20%;
|
||||
width: 40%;
|
||||
margin: auto;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-style: rgb(10, 22, 44);
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
padding-top: 5%;
|
||||
}
|
||||
dialog::backdrop {
|
||||
background-color: rgba(75, 75, 75, 0.598);
|
||||
}
|
||||
.dialogbutton{
|
||||
height: 25%;
|
||||
width: 40%;
|
||||
font-size: medium;
|
||||
border: solid white 0px;
|
||||
background: linear-gradient(to right, rgb(26, 117, 172), rgb(26, 158, 144));
|
||||
color: white;
|
||||
cursor: hand;
|
||||
box-shadow: 0px 0px 0px #424242;
|
||||
transition: 0.3s;
|
||||
border-radius: 5px;
|
||||
margin-top: 5%;
|
||||
}
|
||||
.dialogbutton:hover {
|
||||
box-shadow: 0px 0px 10px #424242;
|
||||
}
|
||||
input{
|
||||
font-size: 100%;
|
||||
text-align: center;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 5px;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
outline: none;
|
||||
border-bottom: 1px solid grey;
|
||||
height: 20%;
|
||||
width: 40%;
|
||||
box-shadow: 0px 0px 0px #424242;
|
||||
transition: 0.3s;
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
input:focus{
|
||||
background-color: rgb(234, 241, 254);
|
||||
box-shadow: 0px 0px 10px #424242;
|
||||
}
|
||||
input:hover{
|
||||
box-shadow: 0px 0px 10px #424242;
|
||||
}
|
||||
197
indexes/user/railway.php
Normal file
197
indexes/user/railway.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<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;">Railway</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_railway_station JOIN cities ON transport_railway_station.city_id=cities.id GROUP BY city_id HAVING COUNT(station_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 railway 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/RaInfo.php?id=' + data[i].train_id + '\', \'_blank\');">';
|
||||
html += '<tr style="border-top-left-radius:10px; border-top-right-radius:10px;"><td >Railway number</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].train_code + '</p></td></tr>';
|
||||
html += '<tr><td style="width: 200px;"><p style="width:150px;">Departure city:</p></td><td><p style="width:200px; font-size:30px;"><i><b>' + data[i].from_name + '</p></b></i></td>';
|
||||
html += '<td><img src="../../img/transport/11.png" width=140; height=90; alt="image"></td>';
|
||||
html += '<td style="width: 200px;"><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", "getRailway.php?departureCity="+departureCity+"&destinationCity="+destinationCity, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
</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>
|
||||
21
indexes/user/stays.js
Normal file
21
indexes/user/stays.js
Normal file
@@ -0,0 +1,21 @@
|
||||
document.getElementById('searchForm').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Serialize the form data
|
||||
var formData = new FormData(this);
|
||||
|
||||
// Perform the AJAX request to the server
|
||||
fetch('search_hotels.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(hotels => {
|
||||
// Process the returned hotel data
|
||||
console.log(hotels); // For debugging purposes
|
||||
// You will need to write code to display the hotels on the page
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
472
indexes/user/stays.php
Normal file
472
indexes/user/stays.php
Normal file
@@ -0,0 +1,472 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Stay@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>
|
||||
.pagebutton{
|
||||
background-color: #ADD8FF;
|
||||
border: none;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
width:5%;
|
||||
border-radius: 10px;
|
||||
font-size:17px;
|
||||
transition:background-color 0.3s ease;
|
||||
}
|
||||
.hotel{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
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;
|
||||
}
|
||||
</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'] === 'seller'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../seller/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>";
|
||||
}
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'guide'){
|
||||
echo "<script type='text/javascript'>
|
||||
window.top.location.href = '../guide/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">
|
||||
<?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="#" style="border-color: white;">
|
||||
<img src="../../icon/header/stays.svg" alt="Stays">
|
||||
</a>
|
||||
<a href="transport.php">
|
||||
<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><br><br>
|
||||
|
||||
<!-- Search Box Container -->
|
||||
<div id="searchBox" class="sticky-search-box">
|
||||
<form id="searchForm" method="post">
|
||||
<!-- Input field for state -->
|
||||
<div class="input-field with-button" style="min-width: 80px; max-width: 200px;">
|
||||
<input type="text" value=" " style="display:none;" readonly>
|
||||
<label for="state">State</label>
|
||||
<select class="edit-button" id="state" name="state" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
// Fetch states with country ID 45 from the database
|
||||
$query = "SELECT `id`, `name` FROM states WHERE country_id = 45";
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Check if the query was successful
|
||||
if ($result) {
|
||||
// Populate the dropdown with states
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$stateId = $row['id'];
|
||||
$stateName = $row['name'];
|
||||
echo "<option value='$stateId'>$stateName</option>";
|
||||
}
|
||||
echo '</select>';
|
||||
} else {
|
||||
echo "Error fetching states from the database.";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- Input field for city -->
|
||||
<div class="input-field with-button" style="min-width: 80px; max-width: 200px;">
|
||||
<input type="text" value=" " style="display:none;" readonly>
|
||||
<label for="city">City</label>
|
||||
<select class="edit-button" id="city" name="city" disabled>
|
||||
<option value="">Select</option>
|
||||
<!-- Cities will be loaded here based on the selected state -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Input fields for date range -->
|
||||
<div class="input-field with-button" style="min-width: 110px; max-width: 200px;">
|
||||
<input type="text" value=" " style="display:none;" readonly>
|
||||
<label for="start_date">Check-in</label>
|
||||
<input type="date" id="start_date" class="edit-button" name="start_date" style="border:none;" onchange="setMinEndDate()" onkeydown="return false" required>
|
||||
</div>
|
||||
|
||||
<div class="input-field with-button" style="min-width: 110px; max-width: 200px;">
|
||||
<input type="text" value=" " style="display:none;" readonly>
|
||||
<label for="end_date">Check-out</label>
|
||||
<input type="date" id="end_date" class="edit-button" name="end_date" style="border:none;" onkeydown="return false" required>
|
||||
</div>
|
||||
|
||||
<div class="input-field with-button" style="min-width: 80px; max-width: 100px;">
|
||||
<input type="text" value=" " style="display:none;" readonly>
|
||||
<label for="hotel_type">Hotel type</label>
|
||||
<select class="edit-button" id="hotel_type" name="hotel_type">
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
// Fetch states with country ID 45 from the database
|
||||
$query = "SELECT `hotel_type_id`, `hotel_type_name` FROM hotel_type";
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Check if the query was successful
|
||||
if ($result) {
|
||||
// Populate the dropdown with states
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$hoteltypeId = $row['hotel_type_id'];
|
||||
$hoteltypeName = $row['hotel_type_name'];
|
||||
echo "<option value='$hoteltypeId'>$hoteltypeName</option>";
|
||||
}
|
||||
echo '</select>';
|
||||
} else {
|
||||
echo "Error fetching states from the database.";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="input-field with-button" style="min-width: 120px; max-width: 335px;">
|
||||
<input type="text" id="myInput" name="myInput" placeholder=" ">
|
||||
<label for="keyword">Search hotel</label>
|
||||
</div>
|
||||
|
||||
<!-- Search button -->
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<div id="pageContainer" style="display: block;">
|
||||
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<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="../aboutus.php" style="color: white; margin: 0 10px;">About us</a>
|
||||
<a href="../aboutus.php" style="color: white; margin: 0 10px;">Privacy Policy</a>
|
||||
<a href="../aboutus.php" style="color: white; margin: 0 10px;">Terms For Usage</a>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<script>
|
||||
document.getElementById('state').addEventListener('change', function() {
|
||||
var stateId = this.value;
|
||||
var citySelect = document.getElementById('city');
|
||||
|
||||
if(stateId) {
|
||||
citySelect.disabled = false; // Enable the city select element
|
||||
fetchCities(stateId); // Call a function to fetch cities for the selected state
|
||||
} else {
|
||||
citySelect.disabled = true; // Keep the city select element disabled
|
||||
citySelect.innerHTML = '<option value="">Select</option>'; // Reset the cities dropdown
|
||||
}
|
||||
});
|
||||
|
||||
function fetchCities(stateId) {
|
||||
// Use fetch or AJAX to get the cities from the server
|
||||
fetch('getCities.php?state_id=' + stateId)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
var citySelect = document.getElementById('city');
|
||||
citySelect.innerHTML = '<option value="">Select</option>'; // Reset the dropdown
|
||||
|
||||
// Populate the dropdown with the new cities
|
||||
data.forEach(function(city) {
|
||||
var option = document.createElement('option');
|
||||
option.value = city.id;
|
||||
option.textContent = city.name;
|
||||
citySelect.appendChild(option);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function setMinEndDate() {
|
||||
var startDateInput = document.getElementById('start_date');
|
||||
var endDateInput = document.getElementById('end_date');
|
||||
var startDate = new Date(startDateInput.value);
|
||||
|
||||
// Check if the start date is valid before proceeding
|
||||
if (startDateInput.value) {
|
||||
// Set the end date minimum to one day after the start date
|
||||
startDate.setDate(startDate.getDate() + 1);
|
||||
endDateInput.min = formatDate(startDate);
|
||||
|
||||
// If the end date is before the new min, reset it
|
||||
var endDate = new Date(endDateInput.value);
|
||||
if (endDate < startDate) {
|
||||
endDateInput.value = formatDate(startDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var d = new Date(date),
|
||||
month = '' + (d.getMonth() + 1),
|
||||
day = '' + d.getDate(),
|
||||
year = d.getFullYear();
|
||||
|
||||
if (month.length < 2)
|
||||
month = '0' + month;
|
||||
if (day.length < 2)
|
||||
day = '0' + day;
|
||||
|
||||
return [year, month, day].join('-');
|
||||
}
|
||||
|
||||
// Set initial constraints on dates
|
||||
window.onload = function() {
|
||||
var today = new Date();
|
||||
var tomorrow = new Date(today);
|
||||
tomorrow.setDate(tomorrow.getDate() + 1); // Set tomorrow's date
|
||||
|
||||
var nextYear = new Date(today);
|
||||
nextYear.setFullYear(today.getFullYear() + 1);
|
||||
|
||||
var startDateInput = document.getElementById('start_date');
|
||||
var endDateInput = document.getElementById('end_date');
|
||||
|
||||
startDateInput.min = formatDate(today);
|
||||
startDateInput.max = formatDate(nextYear);
|
||||
startDateInput.value = formatDate(today); // Set default value to today
|
||||
|
||||
endDateInput.min = formatDate(tomorrow);
|
||||
endDateInput.max = formatDate(nextYear);
|
||||
endDateInput.value = formatDate(tomorrow); // Set default value to tomorrow
|
||||
};
|
||||
|
||||
// Attach onchange event listeners
|
||||
document.getElementById('start_date').addEventListener('change', setMinEndDate);
|
||||
|
||||
document.getElementById('searchForm').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Validate required fields
|
||||
var state = document.getElementById('state').value;
|
||||
var startDate = document.getElementById('start_date').value;
|
||||
var endDate = document.getElementById('end_date').value;
|
||||
|
||||
if (state && startDate && endDate) {
|
||||
// All required fields are filled, submit the form or call your function
|
||||
myFunction();
|
||||
} else {
|
||||
// Not all required fields are filled
|
||||
alert('Please fill all required fields.');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
var judge=1;
|
||||
|
||||
function changePage(pageNumber) {
|
||||
currentPage = pageNumber;
|
||||
myFunction();
|
||||
}
|
||||
|
||||
function myFunction() {
|
||||
var state = document.getElementById('state').value;
|
||||
var city = document.getElementById('city').value;
|
||||
var start_date = document.getElementById('start_date');
|
||||
var end_date = document.getElementById('end_date');
|
||||
var hotel_type = document.getElementById('hotel_type').value;
|
||||
var input = document.getElementById('myInput');
|
||||
var myinput = 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;
|
||||
totalPages = response.total_pages;
|
||||
var time=response.time;
|
||||
time=time.toFixed(6);
|
||||
var html = '';
|
||||
if (data[0]=="No result"){
|
||||
html="<p style='text-align:center; font-size:40px;'>Sorry, we did not find what you are looking for.</p>";
|
||||
judge=0;
|
||||
}else{
|
||||
html+='Running time: '+time+'s';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += '<div class="hotel" style="cursor:default;">';
|
||||
html += '<table style="border: none; cursor:pointer;" onclick="window.open(\'./getInfo/HoInfo.php?id=' + data[i].hotel_id + '\', \'_blank\');">';
|
||||
html += '<tr><td rowspan="5"><img width=130; height=100; src="data:image/jpeg;base64,'+data[i].image+'" alt="Hotel Image"></td>';
|
||||
html += '<td>Name</td><td><p style="font-size:20px; font-family: Times New Roman, Times, serif;">' + data[i].hname + '</p></td></tr>';
|
||||
html += '<tr><td>City</td><td>' + data[i].cname + '</td></tr>';
|
||||
html += '<tr><td>Rating</td><td>';
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (j < Math.floor(data[i].rating)) {
|
||||
html += '<img width="30" height="30" src="../../icon/filled_star.svg" alt="Filled Star">';
|
||||
} else if (j < data[i].rating && data[i].rating - j < 1) {
|
||||
html += '<img width="30" height="30" src="../../icon/half_star.svg" alt="Half Star">';
|
||||
} else {
|
||||
html += '<img width="30" height="30" src="../../icon/empty_star.svg" alt="Empty Star">';
|
||||
}
|
||||
}
|
||||
html += '</td></tr>';
|
||||
html += '<tr><td>Type</td><td>' + data[i].hotel_type_name + '</td></tr>';
|
||||
html += '</table>';
|
||||
html += '</div><br>';
|
||||
}
|
||||
|
||||
html += '<p style="text-align:center; font-size:30px;">Current page:' + currentPage+'</p>';
|
||||
|
||||
}
|
||||
document.getElementById("pageContainer").innerHTML = html;
|
||||
generatePageButtons();
|
||||
}
|
||||
};
|
||||
|
||||
xmlhttp.open("GET", "getHotel.php?state="+state+"&city="+city+"&start_date="+start_date+"&end_date="+end_date
|
||||
+"&hotel_type="+hotel_type+"&myinput="+myinput
|
||||
+"&page="+currentPage, true);
|
||||
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function addToPlan(hotelId) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("GET", "plans.php?hotel_id=" + hotelId, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function generatePageButtons() {
|
||||
var html = '';
|
||||
var startPage = Math.max(currentPage - 2, 1);
|
||||
var endPage = Math.min(currentPage + 2, totalPages);
|
||||
var html2='';
|
||||
|
||||
|
||||
// Always add the first page button
|
||||
if ((currentPage != 1||currentPage != 2||currentPage == 3)&&endPage!=0) {
|
||||
html += '<button class="pagebutton" onclick="changePage(1)">1</button>';
|
||||
}
|
||||
|
||||
// Add "..." before current pages
|
||||
if (startPage > 2&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Add buttons for current pages
|
||||
for (var i = startPage+1; i <= endPage; i++) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + i + ')">' + i + '</button>';
|
||||
}
|
||||
|
||||
// Add "..." after current pages
|
||||
if (endPage < totalPages - 1&&endPage!=0) {
|
||||
html += '.............';
|
||||
}
|
||||
|
||||
// Always add the last page button
|
||||
if (currentPage != totalPages && totalPages != 2&& totalPages != 3&& totalPages != 4&& totalPages != 5) {
|
||||
html += '<button class="pagebutton" onclick="changePage(' + totalPages + ')">' + totalPages + '</button>';
|
||||
}
|
||||
|
||||
document.getElementById("pageButtons").innerHTML = html;
|
||||
}
|
||||
|
||||
</script>
|
||||
159
indexes/user/transport.php
Normal file
159
indexes/user/transport.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Transport@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:750px;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
.hotel:hover{
|
||||
transform: scale(1.03);
|
||||
}
|
||||
.hotel2{
|
||||
background-color:rgba(355,355,355,0.7);
|
||||
width:750px;
|
||||
margin:0 auto;
|
||||
cursor:pointer;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
.hotel2:hover{
|
||||
transform: scale(1.03);
|
||||
}
|
||||
.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;
|
||||
}
|
||||
</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">
|
||||
<?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="#" 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>
|
||||
|
||||
<div id="pageContainer" style="display: block;">
|
||||
<br>
|
||||
<a href="flight.php" style="text-decoration:none;"><div class="hotel" style="color:white; text-align:center; background-image:url(../../img/transport/6.png);">
|
||||
<p style="text-align:center;"><i>Travel by Plane</i>
|
||||
</div></a><br>
|
||||
<a href="railway.php" style="text-decoration:none;"><div class="hotel" style=" color:white; text-align:center; background-image:url(../../img/transport/8.png);">
|
||||
<p style="text-align:center;"><i>Travel by Railway</i>
|
||||
</div></a>
|
||||
<br><br>
|
||||
</button>
|
||||
</div>
|
||||
<div id="pageButtons" class="buttonDiv"></div>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<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="../aboutus.php" style="color: white; margin: 0 10px;">About us</a>
|
||||
<a href="../aboutus.php" style="color: white; margin: 0 10px;">Privacy Policy</a>
|
||||
<a href="../aboutus.php" style="color: white; margin: 0 10px;">Terms For Usage</a>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
</html>
|
||||
Reference in New Issue
Block a user