209 lines
7.8 KiB
PHP
209 lines
7.8 KiB
PHP
<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>
|