2025-06-06 17:14:52 +08:00

115 lines
4.3 KiB
PHP

<html>
<head>
<title>Online Fruit Store</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="../../index.css" type="text/css" />
<script src="../../home.js"></script>
</head>
<body>
<div class="dynamic-background"></div>
<table id="banner">
<tr>
<td width="3%"></td>
<td style="text-align: right" width="6%">
<img class="banner_img" src="../../icon/icon.svg" onmousedown="changetohome()">
</td>
<td width="70%">
<p onmousedown="changetohome()">Online Fruit Store</p>
</td>
<td width="6%">
<img title="Search" id="search_icon" class="banner_img" src="../../icon/search.svg" alt="Search"
onclick="search()">
</td>
<td width="6%">
<img title="Edit" class="banner_img" id="edit" src="../../icon/edit.svg" alt="Cart"
onmousedown="edit()">
</td>
<td width="6%">
<img title="User" class="banner_img" src="../../icon/user.svg" alt="User"
onmousedown="makeIFrame('../../login/login.php', 'login', 'overlay')">
</td>
<td width="3%"></td>
</tr>
</table>
<?php
include "../ConnectDB.php";
// Start the session
session_start();
if(isset($_SESSION['user_type'])) {
$type = $_SESSION['user_type'];
}
else{
echo "<script type='text/javascript'>
window.top.location.href = '../../index.html';
</script>";
}
?>
<script>
var existence = document.getElementById("customerpage");
if (!existence) {
// Create the iframe and add it to the overlay div
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "./overview.php");
iframe.id = "customerpage";
document.body.appendChild(iframe);
}
function changetohome(){
window.top.location.href = '../../home.php';
}
function edit(){
if(document.getElementById("edit").title == "Edit"){
document.getElementById("edit").src = "../../icon/discard.svg";
iframe.setAttribute("src", "./edit.php");
document.getElementById("edit").title = "Discard";
}
else{
overview();
}
}
function overview(){
document.getElementById("edit").src = "../../icon/edit.svg";
iframe.setAttribute("src", "./overview.php");
document.getElementById("edit").title = "Edit";
}
function addfruit(){
makeIFrame("./fruit_add.php", "login", "overlay");
}
//function override
function search(){
var existence = document.getElementById("search");
if(!existence){
makeSearchFrame('../search/search.php', 'search', 'search_overlay');
document.getElementById("search_icon").src="../../icon/del.svg";
}
else{
document.getElementById("search_icon").src="../../icon/search.svg";
closeSearchFrame();
}
}
function closeSearchFrame() {
loginID = "search";
overlayID = "search_overlay";
var iframe = document.getElementById(loginID);
if (iframe) {
iframe.parentNode.removeChild(iframe);
var overlay = document.getElementById(overlayID);
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
}
document.getElementById("search_icon").src="../../icon/search.svg";
}
</script>
</body>
</html>