Initial commit

This commit is contained in:
ldy 2025-06-06 17:14:52 +08:00
parent 0465a9baef
commit f0aabfb5ac
91 changed files with 4466 additions and 0 deletions

149
cart.css Normal file
View File

@ -0,0 +1,149 @@
#grid{
position:absolute;
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%;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
user-select: none;
width: 80%;
height: 5vw;
transition: 0.3s;
}
#items:hover{
box-shadow: 0px 0px 10px rgb(106, 104, 104);
}
img{
border-radius: 12px;
width:80%;
height: 80%;
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;
}
img:hover{
box-shadow: 0px 0px 10px rgb(106, 104, 104);
}
#icon{
border-radius: 12%;
width: 6%;
height: 6%;
overflow:hidden;
cursor: hand;
transition: 0.5s;
}
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;
}
body{
height: 100%;
width: 99%;
z-index: 1;
align-items: center;
overflow-x: hidden;
overflow-y: auto;
}
/* Hide scrollbar when not needed */
body::-webkit-scrollbar {
width: 0.5em;
}
body::-webkit-scrollbar-thumb {
width: 0.5em;
background: linear-gradient(rgba(109, 103, 103, 0.6), #00000000);
border-radius: 0.25em;
}
#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;
}

68
cart.php Normal file
View File

@ -0,0 +1,68 @@
<html>
<head>
<title>Cart</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>
<!--banner-->
<table id="banner">
<tr>
<td width="3%"></td>
<td style="text-align: right" width="6%">
<img class="banner_img" width="64%" height="64%" 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="Cart" class="banner_img" id="cart" src="./icon/home.svg" alt="Cart"
onmousedown="changetohome()">
</td>
<td width="6%">
<img title="Login" 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 "./indexes/ConnectDB.php";
// Start the session
session_start();
//determine whether logged in
if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin'] === true) {
echo "<script type='text/javascript'>
window.top.location.href = './index.html';
</script>";
}
?>
<!--open cart index-->
<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", "./indexes/process/cart_index.php");
iframe.id = "customerpage";
document.body.appendChild(iframe);
}
function changetohome(){
window.top.location.href = './home.php';
}
</script>
</body>
</html>

93
home.js Normal file
View File

@ -0,0 +1,93 @@
function makeIFrame(url, loginID, overlayID) {
var existence = document.getElementById(loginID);
if (!existence) {
// Create the overlay div and add it to the page
var overlay = document.createElement("div");
overlay.id = overlayID;
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 = loginID;
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 iframe when clicked outside
setTimeout(function() {
overlay.addEventListener("click", closeIFrame);
}, 100);
}
}
function closeIFrame() {
loginID = "login";
overlayID = "overlay";
var iframe = document.getElementById(loginID);
if (iframe) {
iframe.parentNode.removeChild(iframe);
var overlay = document.getElementById(overlayID);
if (overlay) {
overlay.removeEventListener("click", closeIFrame);
overlay.parentNode.removeChild(overlay);
}
}
}
function search(){
var existence = document.getElementById("search");
if(!existence){
makeSearchFrame('./indexes/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 makeSearchFrame(url, loginID, overlayID) {
var existence = document.getElementById(loginID);
if (!existence) {
// Create the overlay div and add it to the page
var overlay = document.createElement("div");
overlay.id = overlayID;
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 = loginID;
overlay.appendChild(iframe);
// Add event listener to close iframe when clicked outside
setTimeout(function() {
overlay.addEventListener("click", closeSearchFrame);
}, 100);
}
}
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";
}

77
home.php Normal file
View File

@ -0,0 +1,77 @@
<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>
<!--banner-->
<table id="banner">
<tr>
<td width="3%"></td>
<td style="text-align: right" width="6%">
<img width="64%" class="banner_img" height="64%" 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="Cart" class="banner_img" id="cart" src="./icon/cart.svg" alt="Cart"
onmousedown="changetocart()">
</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 "./indexes/ConnectDB.php";
// Start the session
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === "admin"){
echo "<script type='text/javascript'>
window.top.location.href = './indexes/manage/admin.php';
</script>";
}
}
else{
echo "<script type='text/javascript'>
window.top.location.href = './index.html';
</script>";
}
?>
<!--open buyer/seller page-->
<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", "./indexes/process/index_.php");
iframe.id = "customerpage";
document.body.appendChild(iframe);
}
function changetohome(){
window.top.location.href = './home.php';
}
function changetocart(){
window.top.location.href = './cart.php';
}
</script>
</body>
</html>

1
icon/add.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683641016938" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4292" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M675.328 117.717333A425.429333 425.429333 0 0 0 512 85.333333C276.352 85.333333 85.333333 276.352 85.333333 512s191.018667 426.666667 426.666667 426.666667 426.666667-191.018667 426.666667-426.666667c0-56.746667-11.093333-112-32.384-163.328a21.333333 21.333333 0 0 0-39.402667 16.341333A382.762667 382.762667 0 0 1 896 512c0 212.074667-171.925333 384-384 384S128 724.074667 128 512 299.925333 128 512 128c51.114667 0 100.8 9.984 146.986667 29.12a21.333333 21.333333 0 0 0 16.341333-39.402667zM490.666667 490.666667h-149.482667A21.269333 21.269333 0 0 0 320 512c0 11.861333 9.493333 21.333333 21.184 21.333333H490.666667v149.482667c0 11.690667 9.557333 21.184 21.333333 21.184 11.861333 0 21.333333-9.493333 21.333333-21.184V533.333333h149.482667A21.269333 21.269333 0 0 0 704 512c0-11.861333-9.493333-21.333333-21.184-21.333333H533.333333v-149.482667A21.269333 21.269333 0 0 0 512 320c-11.861333 0-21.333333 9.493333-21.333333 21.184V490.666667z" fill="#0A162C" p-id="4293"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
icon/addcart.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683441598582" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2703" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.1953125" height="200"><path d="M756.685272 66.086238c-111.451578 0-201.814873 87.405798-201.814873 195.188647 0 107.809456 90.363295 195.187624 201.814873 195.187624 111.476138 0 201.810779-87.379191 201.810779-195.187624C958.497075 153.491013 868.16141 66.086238 756.685272 66.086238zM756.685272 411.90869c-86.003802 0-155.70146-67.433997-155.70146-150.633805 0-83.200831 69.697658-150.658365 155.70146-150.658365 86.001755 0 155.726021 67.45651 155.726021 150.658365C912.409246 344.475716 842.688051 411.90869 756.685272 411.90869zM821.007245 796.503003c-1.5555-0.32031-3.162168-0.490187-4.81284-0.490187L417.735675 796.012816l-18.169673-67.016468 335.668721-24.971916c12.850272-0.935347 22.557821-11.433949 22.278445-23.747983l29.81955-185.661209c-10.027858 1.343665-20.255271 2.051827-30.644374 2.051827-6.184136 0-12.305847-0.252769-18.368204-0.737839l-26.183568 163.020497-325.014569 24.134811-85.406162-315.013318 248.455313 0c-7.391695-14.728129-13.293385-30.354764-17.522913-46.671141l-241.818854 0c-0.588429 0-1.172765 0.027631-1.748914 0.067541l-28.967095-106.840339c-0.383758-12.56578-11.052237-22.639689-24.132764-22.639689L87.978877 191.987592c-13.323062 0-24.122531 10.446411-24.122531 23.335571 0 12.890183 10.802538 23.334547 24.122531 23.334547l128.761632 0 151.115805 557.358176-45.213883 0c-1.539126 0-3.042435 0.14941-4.497646 0.425716-2.851068-0.279376-5.744093-0.425716-8.674983-0.425716-46.644534 0-84.448302 36.555274-84.448302 81.697523 0 45.092104 37.802744 81.673985 84.448302 81.673985 46.642487 0 84.448302-36.581881 84.448302-81.673985 0-13.382417-3.345348-25.998341-9.232711-37.143703l10.528279 0c2.203284 0.30496 4.475133 0.315193 6.758238 0l334.597268 0c-5.89248 11.145362-9.233735 23.761286-9.233735 37.143703 0 45.092104 37.803768 81.673985 84.474909 81.673985 46.61895 0 84.448302-36.581881 84.448302-81.673985C896.259676 835.576755 863.302519 800.937202 821.007245 796.503003zM309.473895 922.238574c-25.448799 0-46.082712-19.920634-46.082712-44.530282s20.633913-44.58145 46.082712-44.58145 46.057128 19.974872 46.057128 44.58145S334.922695 922.238574 309.473895 922.238574zM811.811375 922.238574c-25.447776 0-46.059175-19.920634-46.059175-44.530282s20.611399-44.58145 46.059175-44.58145c25.424239 0 46.059175 19.974872 46.059175 44.58145S837.23459 922.238574 811.811375 922.238574zM859.246962 240.029006l-80.576949 0 0-78.004233c0-7.820481-6.547427-14.163237-14.648308-14.163237l-14.647284 0c-8.07939 0-14.647284 6.342756-14.647284 14.163237l0 78.004233-80.551365 0c-8.102927 0-14.674915 6.343779-14.674915 14.164261l0 14.188821c0 7.821504 6.571988 14.189844 14.674915 14.189844l80.551365 0 0 77.978649c0 7.818434 6.569941 14.188821 14.647284 14.188821l14.647284 0c8.10088 0 14.648308-6.370387 14.648308-14.188821l0-77.978649 80.576949 0c8.07325 0 14.620677-6.369363 14.620677-14.189844l0-14.188821C873.869686 246.372785 867.320212 240.029006 859.246962 240.029006z" fill="#0A162C" p-id="2704"></path></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

1
icon/admin.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683383609055" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4283" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M534.186667 810.666667H303.914667C253.952 810.666667 213.333333 769.578667 213.333333 719.061333c0-50.517333 40.618667-91.605333 90.538667-91.605333h228.565333a21.333333 21.333333 0 0 0 0-42.666667H303.872c-73.429333 0-133.248 60.245333-133.248 134.272C170.666667 793.088 230.4 853.333333 303.914667 853.333333h230.357333a21.333333 21.333333 0 0 0 0-42.666666M517.632 552.149333c80.64 0 152.277333-46.677333 182.613333-118.954666a21.333333 21.333333 0 0 0-39.338666-16.512c-23.594667 56.362667-79.914667 92.8-143.274667 92.8-85.205333 0-154.496-66.432-154.496-148.053334 0-29.525333 9.045333-58.026667 26.112-82.474666C418.048 237.866667 466.048 213.333333 517.632 213.333333c51.541333 0 99.498667 24.490667 128.256 65.536 5.973333 8.576 11.050667 17.706667 15.018667 27.178667a21.333333 21.333333 0 0 0 39.338666-16.597333 189.44 189.44 0 0 0-19.413333-35.072C644.096 201.941333 583.04 170.666667 517.632 170.666667c-65.493333 0-126.549333 31.317333-163.285333 83.84A185.258667 185.258667 0 0 0 320.426667 361.386667c0 105.216 88.448 190.762667 197.12 190.762666" fill="#0A162C" p-id="4284"></path><path d="M704.853333 830.250667a106.794667 106.794667 0 0 1-106.666666-106.666667c0-58.794667 47.829333-106.666667 106.666666-106.666667 58.88 0 106.666667 47.872 106.666667 106.666667 0 58.752-47.786667 106.666667-106.666667 106.666667m0-256c-82.346667 0-149.333333 66.986667-149.333333 149.333333s66.986667 149.333333 149.333333 149.333333 149.333333-66.986667 149.333334-149.333333-66.986667-149.333333-149.333334-149.333333" fill="#0A162C" p-id="4285"></path><path d="M704.853333 659.541333a64 64 0 1 0 0.085334 128.042667 64 64 0 0 0-0.042667-128" fill="#0A162C" p-id="4286"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

1
icon/buy.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683444535623" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4408" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M895.6 860.048l0.144-0.016-64-512-0.144 0.016A31.888 31.888 0 0 0 800 320h-110.816l-1.52-22.864h-0.016C684 203.28 606.736 128 512 128s-172 75.28-175.648 169.136h-0.032L334.8 320H224c-16.32 0-29.632 12.256-31.6 28.048l-0.144-0.016-64 512 0.144 0.016c-0.16 1.312-0.4 2.592-0.4 3.952a32 32 0 0 0 32 32h704a32 32 0 0 0 32-32c0-1.36-0.24-2.64-0.4-3.952zM400.176 301.36h-0.048C401.552 240.832 451.136 192 512 192s110.448 48.832 111.872 109.36h-0.048L625.056 320H398.944l1.232-18.64z m-80.112 240.512l0.144 0.016c-0.048 0.704-0.208 1.392-0.208 2.112a31.92 31.92 0 1 0 63.792 2.112l0.144 0.016L394.688 384h234.608l10.768 162.128 0.128-0.016A31.952 31.952 0 0 0 704 544c0-0.72-0.16-1.408-0.208-2.112l0.144-0.016L693.44 384h78.304l56 448H196.24l56-448h78.304l-10.48 157.872z" fill="#0A162C" p-id="4409"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

1
icon/buyatonce.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683441626021" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3791" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M883.8144 305.373867H140.1856a68.266667 68.266667 0 0 0-67.925333 75.178666l50.056533 491.52a68.266667 68.266667 0 0 0 67.925333 61.354667h643.5328a68.266667 68.266667 0 0 0 67.925334-61.354667l50.039466-491.52a68.266667 68.266667 0 0 0-67.925333-75.178666z m-743.6288 68.266666h743.6288l-50.039467 491.52H190.225067l-50.039467-491.52z" fill="#0A162C" p-id="3792"></path><path d="M607.573333 85.333333a102.4 102.4 0 0 1 102.331734 98.56L709.973333 187.733333v228.437334a34.133333 34.133333 0 0 1-68.164266 2.56l-0.1024-2.56V187.733333a34.133333 34.133333 0 0 0-31.573334-34.030933L607.573333 153.6H416.426667a34.133333 34.133333 0 0 0-34.030934 31.5904l-0.1024 2.56v228.420267a34.133333 34.133333 0 0 1-68.164266 2.56l-0.1024-2.56V187.733333a102.4 102.4 0 0 1 98.56-102.314666L416.426667 85.333333h191.146666z" fill="#0A162C" p-id="3793"></path><path d="M699.733333 733.866667v34.133333a34.133333 34.133333 0 0 1-34.133333 34.133333H358.4a34.133333 34.133333 0 0 1-34.133333-34.133333v-34.133333h375.466666z" fill="#0A162C" p-id="3794"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
icon/buyer.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683383630337" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4668" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M517.632 552.149333c-108.714667 0-197.162667-85.546667-197.162667-190.72 0-38.314667 11.690667-75.306667 33.877334-106.922666C391.04 202.026667 452.138667 170.666667 517.632 170.666667c65.408 0 126.464 31.274667 163.2 83.712 7.765333 11.093333 14.250667 22.869333 19.413333 35.072a21.333333 21.333333 0 1 1-39.338666 16.64 147.285333 147.285333 0 0 0-15.018667-27.221334C617.130667 237.824 569.173333 213.333333 517.632 213.333333c-51.626667 0-99.584 24.533333-128.426667 65.621334a143.445333 143.445333 0 0 0-26.069333 82.432c0 81.664 69.290667 148.096 154.453333 148.096 63.402667 0 119.722667-36.437333 143.36-92.8a21.333333 21.333333 0 0 1 39.338667 16.512c-30.378667 72.277333-102.016 118.954667-182.656 118.954666" fill="#0A162C" p-id="4669"></path><path d="M303.829333 627.456c-49.92 0-90.453333 41.088-90.453333 91.605333C213.333333 769.578667 253.866667 810.666667 303.786667 810.666667h416.341333C770.133333 810.666667 810.666667 769.578667 810.666667 719.061333c0-50.517333-40.533333-91.605333-90.453334-91.605333H303.786667zM720.213333 853.333333H303.829333C230.442667 853.333333 170.709333 793.088 170.709333 719.061333 170.666667 645.034667 230.4 584.789333 303.786667 584.789333h416.341333C793.6 584.789333 853.333333 645.034667 853.333333 719.061333 853.333333 793.088 793.6 853.333333 720.213333 853.333333z" fill="#0A162C" p-id="4670"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

1
icon/cart.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683267175064" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3820" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M384 768a64 64 0 1 0 0.032 128.032A64 64 0 0 0 384 768M704 768a64 64 0 1 0 0.032 128.032A64 64 0 0 0 704 768M312.672 512l-51.424-192h560.96l-51.456 192H312.672z m583.36-224a32 32 0 0 0-32-32H244.064L209.792 128H96.032v64h64.64l145.728 544H800v-64H355.52l-25.696-96h490.048l12.16-45.376 64-238.88-0.768-0.192C895.424 290.336 896 289.28 896 288z" fill="#0a162c" p-id="3821"></path><path d="M448 448h192v-64h-192z" fill="#0a162c" p-id="3822"></path></svg>

After

Width:  |  Height:  |  Size: 785 B

1
icon/cart_empty.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683267168230" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3544" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M384 768a64 64 0 1 0 0.032 128.032A64 64 0 0 0 384 768M704 768a64 64 0 1 0 0.032 128.032A64 64 0 0 0 704 768M312.672 512l-51.456-192h560.96l-51.456 192H312.672z m583.36-224a32 32 0 0 0-32-32H244.064L209.824 128H96v64h64.672l145.728 544H800v-64H355.52l-25.664-96H819.84l12.16-45.376 64-238.88-0.768-0.192C895.424 290.336 896 289.28 896 288z" fill="#0a162c" p-id="3545"></path></svg>

After

Width:  |  Height:  |  Size: 714 B

1
icon/check.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683379882704" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3399" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 896C299.936 896 128 724.064 128 512S299.936 128 512 128s384 171.936 384 384-171.936 384-384 384m0-832C264.96 64 64 264.96 64 512s200.96 448 448 448 448-200.96 448-448S759.04 64 512 64" fill="#85a893" p-id="3400"></path><path d="M432 618.752l-121.376-121.376-45.248 45.248 166.624 166.624 326.624-326.624-45.248-45.248z" fill="#85a893" p-id="3401"></path></svg>

After

Width:  |  Height:  |  Size: 698 B

1
icon/checkout.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683441572164" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4283" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M638.378667 543.786667a21.333333 21.333333 0 0 0 0-42.666667h-124.885334v-23.893333l103.765334-97.92a21.333333 21.333333 0 1 0-29.312-31.061334l-98.090667 92.586667-98.133333-92.586667a21.333333 21.333333 0 0 0-29.269334 31.061334l108.373334 102.314666v19.498667H339.712a21.333333 21.333333 0 0 0 0 42.666667h131.114667v59.989333H339.712a21.333333 21.333333 0 0 0 0 42.666667h131.114667v93.781333a21.333333 21.333333 0 0 0 42.666666 0V646.4h124.885334a21.333333 21.333333 0 1 0 0-42.666667h-124.885334v-59.989333h124.885334z" fill="#0A162C" p-id="4284"></path><path d="M829.056 572.544a20.053333 20.053333 0 0 0-23.381333 16.298667 320.597333 320.597333 0 0 1-316.16 264.490666c-177.152 0-321.237333-144.085333-321.237334-321.194666a321.109333 321.109333 0 0 1 587.52-179.584c10.410667 15.36 19.626667 31.872 27.178667 48.938666 4.522667 10.154667 16.384 14.762667 26.581333 10.154667a19.797333 19.797333 0 0 0 10.069334-10.24 19.84 19.84 0 0 0 2.901333-9.813333V272.810667a20.181333 20.181333 0 0 0-40.32 0v48.170666a360.789333 360.789333 0 0 0-592.554667 9.173334A359.68 359.68 0 0 0 128 532.138667C128 731.477333 290.176 893.610667 489.472 893.610667a360.874667 360.874667 0 0 0 355.882667-297.685334 20.181333 20.181333 0 0 0-16.298667-23.381333" fill="#0A162C" p-id="4285"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

1
icon/close.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683382961424" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3614" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 896C299.936 896 128 724.064 128 512S299.936 128 512 128s384 171.936 384 384-171.936 384-384 384m0-832C264.96 64 64 264.96 64 512s200.96 448 448 448 448-200.96 448-448S759.04 64 512 64" fill="#d42b3d" p-id="3615"></path><path d="M665.376 313.376L512 466.752l-153.376-153.376-45.248 45.248L466.752 512l-153.376 153.376 45.248 45.248L512 557.248l153.376 153.376 45.248-45.248L557.248 512l153.376-153.376z" fill="#d42b3d" p-id="3616"></path></svg>

After

Width:  |  Height:  |  Size: 781 B

1
icon/del.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683641057736" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6520" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M687.603949 656.994302 541.10027 510.457878 687.603949 363.943966c8.829086-8.840342 8.829086-23.122627 0-31.961946-8.850575-8.840342-23.13286-8.840342-31.962969 0L509.138324 478.495932 362.623389 331.980997c-8.840342-8.818853-23.122627-8.818853-31.962969 0-8.840342 8.840342-8.840342 23.144116 0 31.984459l146.493445 146.514935L330.638931 656.994302c-8.819876 8.830109-8.819876 23.133883 0 31.962969 8.840342 8.829086 23.144116 8.829086 31.984459 0l146.514935-146.514935 146.502655 146.514935c8.830109 8.829086 23.112394 8.829086 31.962969 0C696.433034 680.129208 696.45657 665.824411 687.603949 656.994302z" fill="#0A162C" p-id="6521"></path><path d="M938.362063 510.457878c0-237.061161-192.174857-429.234995-429.247274-429.234995-237.062184 0-429.246251 192.173834-429.246251 429.234995 0 237.083673 192.185091 429.257507 429.246251 429.257507 97.345072 0 186.435133-33.110095 258.440074-87.677898 2.958378-3.354398 4.900613-7.636934 4.900613-12.449543 0-10.506285-8.521071-19.026332-19.027355-19.026332-5.431709 0-10.287297 2.162246-13.752212 5.826705l-0.2415 0c-64.456011 47.414893-143.745868 75.800383-229.876528 75.800383-214.679407 0-388.730489-174.073594-388.730489-388.719232 0-214.688617 174.051081-388.718209 388.730489-388.718209 214.688617 0 388.697743 174.029592 388.697743 388.718209 0 65.548902-15.386432 127.277802-44.081984 181.490517l0 0.309038c-0.508583 1.811252-1.104147 3.576455-1.104147 5.519714 0 10.507308 8.520047 19.028379 19.028379 19.028379 8.18952 0 15.054881-5.254677 17.703197-12.494569l0 0.132006C920.349827 648.38625 938.362063 581.536726 938.362063 510.457878z" fill="#0A162C" p-id="6522"></path></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

1
icon/discard.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684288939410" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3234" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M805.056 759.808L264.192 218.912A382.24 382.24 0 0 1 512 128.032c212.064 0 384 171.872 384 384 0 94.464-34.24 180.896-90.944 247.776M128 512a382.08 382.08 0 0 1 90.944-247.84l540.864 540.896A381.984 381.984 0 0 1 512 896C299.936 896 128 724.064 128 512M512 64C264.96 64 64 264.96 64 512s200.96 448 448 448 448-200.96 448-448S759.04 64 512 64" fill="#0A162C" p-id="3235"></path></svg>

After

Width:  |  Height:  |  Size: 716 B

1
icon/edit.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684203681551" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3234" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M128 896h768v-64H128zM256 704v-146.752l224-224L626.752 480l-224 224H256zM608 205.248L754.752 352 672 434.752 525.248 288 608 205.248z m214.624 169.408l0.032-0.032a32 32 0 0 0 0-45.248l-0.032-0.032-191.968-191.968-0.032-0.032a32 32 0 0 0-45.248 0l-0.032 0.032L192 530.752V768h237.248l393.376-393.344z" fill="#0A162C" p-id="3235"></path></svg>

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
icon/favicon/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

1
icon/home.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683794222813" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18660" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M898.5 255.6L568.4 76.4c-35.3-19.2-77.6-19.2-112.9 0l-330 179.2C86.4 276.8 62 318.2 62 363.3v476.6C62 907.3 115.7 962 181.9 962H842c66.2 0 119.9-54.7 119.9-122.1V363.3c0.1-45.1-24.3-86.5-63.4-107.7zM872 809.3c0 33.7-26.9 61.1-60 61.1H212c-33.1 0-60-27.3-60-61.1V369.5c0-22.6 12.2-43.3 31.8-53.9l300-162.9c17.6-9.6 38.8-9.6 56.5 0l300 162.9c19.6 10.6 31.8 31.3 31.8 53.9v439.8z" fill="#0A162C" p-id="18661"></path><path d="M677 687.1H347c-24.8 0-45 20.6-45 45.8s20.2 45.8 45 45.8h330c24.8 0 45-20.6 45-45.8s-20.2-45.8-45-45.8z" fill="#0A162C" p-id="18662"></path></svg>

After

Width:  |  Height:  |  Size: 902 B

38
icon/icon.svg Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M470 1929 c-42 -17 -60 -49 -60 -107 0 -101 31 -122 180 -122 l100 0
0 -29 0 -29 -147 -4 c-136 -3 -151 -5 -181 -26 -65 -47 -62 -13 -62 -759 0
-770 -4 -728 80 -771 l44 -22 543 0 c595 0 585 -1 636 59 l27 33 0 698 0 698
-27 33 c-43 50 -76 59 -228 59 l-135 0 0 30 0 30 115 0 c136 0 167 11 185 66
17 50 5 116 -26 145 l-26 24 -496 2 c-313 1 -506 -2 -522 -8z m1014 -52 c13
-10 17 -24 14 -62 -2 -41 -7 -52 -28 -62 -37 -19 -983 -14 -1002 5 -7 7 -13
32 -13 56 0 81 -34 76 519 76 385 0 496 -3 510 -13z m-294 -207 c0 -19 -7 -20
-225 -20 -218 0 -225 1 -225 20 0 19 7 20 225 20 218 0 225 -1 225 -20z m340
-93 c14 -7 33 -28 42 -47 17 -32 18 -86 18 -680 0 -594 -1 -648 -18 -680 -9
-19 -28 -40 -42 -47 -33 -17 -1071 -19 -1118 -2 -65 22 -62 -11 -62 729 0 461
3 678 11 691 25 47 40 48 609 48 408 1 541 -2 560 -12z"/>
<path d="M1372 1513 c2 -9 17 -20 34 -25 37 -9 61 -34 66 -68 4 -31 32 -33 36
-2 4 30 -31 86 -63 100 -39 18 -77 16 -73 -5z"/>
<path d="M1480 1095 c0 -211 2 -245 15 -245 13 0 15 34 15 245 0 211 -2 245
-15 245 -13 0 -15 -34 -15 -245z"/>
<path d="M760 1218 c0 -27 54 -99 91 -121 l40 -24 -38 -16 c-84 -34 -169 -132
-197 -227 -23 -77 -21 -90 12 -90 157 0 261 -171 189 -313 l-24 -46 43 -16
c93 -35 220 -28 311 17 65 33 140 109 171 175 24 51 27 70 27 158 0 89 -3 107
-29 162 -33 72 -107 147 -177 181 -50 24 -161 46 -191 39 -14 -4 -18 1 -18 23
0 39 -41 84 -88 98 -51 16 -122 16 -122 0z"/>
<path d="M1065 1206 c-37 -16 -51 -33 -57 -70 -5 -27 -4 -28 25 -22 31 6 90
54 108 89 8 14 5 17 -18 17 -15 -1 -42 -7 -58 -14z"/>
<path d="M580 709 c-83 -35 -130 -106 -130 -196 0 -72 28 -125 88 -168 38 -26
52 -30 112 -30 60 0 74 4 112 30 61 43 88 95 88 170 0 113 -77 196 -187 202
-32 1 -69 -2 -83 -8z"/>
<path d="M587 213 c-4 -3 -7 -12 -7 -20 0 -11 72 -13 390 -13 383 0 390 0 390
20 0 20 -7 20 -383 20 -211 0 -387 -3 -390 -7z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

1
icon/ok.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684243582971" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3234" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M432 617.6l-121.6-121.6L265.6 544l166.4 166.4L758.4 384l-44.8-48z" fill="#0A162C" p-id="3235"></path></svg>

After

Width:  |  Height:  |  Size: 440 B

1
icon/order.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683441448297" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3234" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M320 480h384v-64H320zM320 608h256v-64h-256zM320 736h256v-64h-256z" fill="#0A162C" p-id="3235"></path><path d="M832 160h-128V96H320v64H192c-19.2 0-32 12.8-32 32v704c0 19.2 12.8 32 32 32h640c19.2 0 32-12.8 32-32V192c0-19.2-12.8-32-32-32zM384 160h256v64h-256V160z m416 704H224V224h96v64h384V224h96v640z" fill="#0A162C" p-id="3236"></path></svg>

After

Width:  |  Height:  |  Size: 674 B

1
icon/search.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683267090707" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3269" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M192 448c0-141.152 114.848-256 256-256s256 114.848 256 256-114.848 256-256 256-256-114.848-256-256z m710.624 409.376l-206.88-206.88A318.784 318.784 0 0 0 768 448c0-176.736-143.264-320-320-320S128 271.264 128 448s143.264 320 320 320a318.784 318.784 0 0 0 202.496-72.256l206.88 206.88 45.248-45.248z" fill="#0a162c" p-id="3270"></path></svg>

After

Width:  |  Height:  |  Size: 672 B

1
icon/seller.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683383640504" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4944" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M517.632 552.149333c80.64 0 152.32-46.677333 182.698667-118.954666a21.162667 21.162667 0 0 0 1.408-6.784 21.290667 21.290667 0 0 0-19.541334-29.866667h-188.202666a21.333333 21.333333 0 1 0 0 42.666667h154.965333c-27.818667 43.264-76.885333 70.272-131.328 70.272-85.162667 0-154.453333-66.432-154.453333-148.053334 0-29.568 9.045333-58.026667 26.026666-82.432A156.416 156.416 0 0 1 517.674667 213.333333c51.541333 0 99.498667 24.490667 128.298666 65.578667 5.973333 8.533333 11.050667 17.621333 15.018667 27.136a21.333333 21.333333 0 0 0 39.338667-16.597333 189.141333 189.141333 0 0 0-19.456-35.072C644.096 201.941333 583.04 170.666667 517.632 170.666667c-65.450667 0-126.506667 31.317333-163.285333 83.84a185.429333 185.429333 0 0 0-33.834667 106.88c0 105.216 88.405333 190.762667 197.12 190.762666" fill="#0A162C" p-id="4945"></path><path d="M720.170667 810.666667H303.872C253.952 810.666667 213.333333 769.578667 213.333333 719.061333c0-50.517333 40.618667-91.605333 90.538667-91.605333h416.298667c49.92 0 90.453333 41.088 90.453333 91.605333C810.666667 769.578667 770.133333 810.666667 720.213333 810.666667m0-225.877334H303.872C230.4 584.789333 170.666667 645.034667 170.666667 719.061333 170.666667 793.088 230.4 853.333333 303.872 853.333333h416.298667c73.386667 0 133.12-60.245333 133.12-134.272C853.333333 645.034667 793.6 584.789333 720.213333 584.789333" fill="#0A162C" p-id="4946"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

1
icon/subtract.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683641048734" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5460" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M675.328 117.717333A425.429333 425.429333 0 0 0 512 85.333333C276.352 85.333333 85.333333 276.352 85.333333 512s191.018667 426.666667 426.666667 426.666667 426.666667-191.018667 426.666667-426.666667c0-56.746667-11.093333-112-32.384-163.328a21.333333 21.333333 0 0 0-39.402667 16.341333A382.762667 382.762667 0 0 1 896 512c0 212.074667-171.925333 384-384 384S128 724.074667 128 512 299.925333 128 512 128c51.114667 0 100.8 9.984 146.986667 29.12a21.333333 21.333333 0 0 0 16.341333-39.402667zM320 512c0-11.776 9.493333-21.333333 21.184-21.333333h341.632c11.690667 0 21.184 9.472 21.184 21.333333 0 11.776-9.493333 21.333333-21.184 21.333333H341.184A21.205333 21.205333 0 0 1 320 512z" fill="#0A162C" p-id="5461"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
icon/user.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683267194008" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4137" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 448c-35.296 0-64-28.704-64-64s28.704-64 64-64 64 28.704 64 64-28.704 64-64 64m0-192c-70.592 0-128 57.408-128 128s57.408 128 128 128 128-57.408 128-128-57.408-128-128-128" fill="#0a162c" p-id="4138"></path><path d="M768 797.632v-69.92a151.904 151.904 0 0 0-151.712-151.68h-208.576A151.904 151.904 0 0 0 256 727.68v69.92C177.632 727.36 128 625.6 128 512 128 299.904 299.936 128 512 128s384 171.904 384 384c0 113.6-49.632 215.36-128 285.632m-448 46.56v-116.48a87.776 87.776 0 0 1 87.712-87.68h208.576A87.776 87.776 0 0 1 704 727.68v116.48a381.568 381.568 0 0 1-384 0m192-780.16C264.96 64 64 264.96 64 512c0 246.976 200.96 448 448 448s448-201.024 448-448c0-247.04-200.96-448-448-448" fill="#0a162c" p-id="4139"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

365
index.css Normal file
View File

@ -0,0 +1,365 @@
#banner{
position: sticky;
background-color: rgba(255, 255, 255, 0.5);
color: black;
font-size: 240%;
box-shadow: 0px 0px 10px rgb(106, 104, 104);
border-radius: 12px;
backdrop-filter: blur(20px);
height: 6%;
width: 98%;
top: 2%;
margin: auto;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
user-select: none;
text-align: left;
z-index: 100;
}
.banner_img{
width: 58%;
height: 58%;
cursor: hand;
}
#banner_img:hover{
width: 60%;
height: 60%;
border-radius: 12px;
box-shadow: 0px 0px 6px #878686;
}
#login{
position: absolute;
text-align: center;
transform: scale(1.7);
/* 垂直居中 */
top: 0;
bottom: 0;
height: 45%;
/* 水平居中 */
left: 0;
right: 0;
width: 40%;
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(6px);
}
#customerpage{
position: absolute;
text-align: center;
top: 0%;
height: 100%;
width: 100%;
left: 0%;
margin: none;
padding: none;
user-select: none;
border: none;
z-index: 0;
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(109, 103, 103, 0.6);
z-index: 10000;
}
#search{
position: fixed;
background-color: rgba(255, 255, 255, 0.5);
box-shadow: 0px 0px 10px rgb(106, 104, 104);
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
backdrop-filter: blur(15px);
height: 70%;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
user-select: none;
text-align: left;
z-index: 10;
border: none;
}
#search_overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(109, 103, 103, 0.6);
z-index: 5;
}
#closebutton{
position: absolute;
text-align: center;
transform: scale(1.4);
top: 14%;
height: 2.2%;
margin-left: 80%;
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;
}
#grid{
position:absolute;
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: none;
border: none;
width: 98%;
left:1.5%;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
}
#items{
text-align: left;
background-color: rgba(255, 255, 255, 0.4);
color: black;
font-size: 200%;
border-radius: 12px;
backdrop-filter: blur(4px);
margin: 1%;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
width: 96%;
height: 5vw;
transition: 0.3s;
}
img{
border-radius: 12px;
width: 10%;
height: 10%;
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);
}
img:hover{
box-shadow: 0px 0px 10px rgb(106, 104, 104);
}
p,h5:hover{
cursor: hand;
}
input{
font-size: 100%;
width: 80%;
border-radius: 12px;
text-align: center;
background-color: rgba(138, 179, 193, 0.632);
border: none;
outline: none;
}
input:focus{
border: 2px solid pink;
}
#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{
align-items: center;
height: 100%;
width: 99%;
z-index: 1;
overflow: hidden;
}
.dynamic-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to right, rgba(255, 165, 0, 1), rgba(173, 216, 230, 1));
animation: changeBackground 15s infinite;
}
@keyframes changeBackground {
0% {
background: linear-gradient(to right, rgba(255, 165, 0, 1), rgba(173, 216, 230, 1));
}
20% {
background: linear-gradient(to right, rgba(255, 165, 0, 0.9), rgba(173, 216, 230, 0.9));
}
40% {
background: linear-gradient(to right, rgba(255, 165, 0, 0.8), rgba(173, 216, 230, 0.8));
}
60% {
background: linear-gradient(to right, rgba(255, 165, 0, 0.7), rgba(173, 216, 230, 0.7));
}
80% {
background: linear-gradient(to right, rgba(255, 165, 0, 0.9), rgba(173, 216, 230, 0.9));
}
100% {
background: linear-gradient(to right, rgba(255, 165, 0, 1), rgba(173, 216, 230, 1));
}
}
/* Hide scrollbar when not needed */
body::-webkit-scrollbar {
width: 0.5em;
}
body::-webkit-scrollbar-thumb {
width: 0.5em;
background: linear-gradient(rgba(109, 103, 103, 0.6), #00000000);
border-radius: 0.25em;
}
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;
}
textarea{
background-color: rgba(138, 179, 193, 0.632);
border: none;
border-radius: 12px;
outline: none;
font-size: 75%;
width: 90%;
height: max-content;
}
textarea:focus{
border: 2px solid pink;
}
td{
font-size: 75%;
font-family: Arial, Helvetica, sans-serif;
}
th{
font-size: 75%;
font-family: Arial, Helvetica, sans-serif;
}
h2{
text-align: center;
}
.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;
}

51
index.html Normal file
View File

@ -0,0 +1,51 @@
<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" />
</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" width="64%" height="64%" src="./icon/icon.svg">
</td>
<td width="70%">
<p>Online Fruit Store</p>
</td>
<td width="6%">
<img class="banner_img" src="./icon/search.svg" alt="Search">
</td>
<td width="6%">
<img class="banner_img" id="cart" src="./icon/cart.svg" alt="Cart">
</td>
<td width="6%">
<img class="banner_img" src="./icon/user.svg" alt="User">
</td>
<td width="3%"></td>
</tr>
</table>
<!--open index_login.php to determine which page to redirect-->
<script>
var existence = document.getElementById("login");
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", "./login/index_login.php");
iframe.id = "login";
overlay.appendChild(iframe);
}
</script>
</body>
</html>

15
indexes/ConnectDB.php Normal file
View File

@ -0,0 +1,15 @@
<?php
$servername = "localhost"; // if use uic server, change to stuweb.bcrab.cn
$username = "swdw"; // change to your account
$password = "MbMXJSxXZbzJ3aZc"; // change to your account
$db = "swdw"; // change to your database name
// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
?>

115
indexes/manage/admin.php Normal file
View File

@ -0,0 +1,115 @@
<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>

View File

@ -0,0 +1,76 @@
<link rel="stylesheet" href="../../index.css" type="text/css" />
<script src="../../home.js"></script>
<html>
<head>
<title>Change img</title>
<style>
body{
align-items: center;
height: 100%;
width: 99%;
z-index: 1;
overflow: hidden;
background-image: none;
}
</style>
</head>
<body>
<h1>Change img</h1>
<?php
// Check if the form was submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Include the database connection file
include '../ConnectDB.php';
$name = $_GET['name'];
// Read the uploaded image file
$image = $_FILES["image"]["tmp_name"];
$imageData = file_get_contents($image);
// Check if the uploaded file is an image
$mime = mime_content_type($image);
$allowedMimeTypes = ['image/jpeg', 'image/png', 'image/gif'];
if (!in_array($mime, $allowedMimeTypes)) {
die("Invalid file format. Only JPEG, PNG, and GIF images are allowed.");
}
// Check if the file size is within limits
$maxFileSize = 1024 * 1024; // 1 MB
if ($_FILES["image"]["size"] > $maxFileSize) {
die("File size exceeds the limit. Maximum allowed size is 1 MB.");
}
// Create a connection to the database
$conn = new mysqli($servername, $username, $password, $db);
// Check for connection errors
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Prepare the SQL statement to update the image
$stmt = $conn->prepare("UPDATE inventory SET img = ? WHERE name = ?");
$stmt->bind_param("ss", $imageData, $name);
// Execute the SQL statement
if ($stmt->execute()) {
echo "Image uploaded successfully.";
} else {
echo "Error uploading image.";
}
// Close the statement
$stmt->close();
}
?>
<form method="POST" action="" enctype="multipart/form-data">
<label for="img">Img:</label>
<input type="file" name="image" accept="image/*" required>
<br><br>
<button type="submit">Change</button>
</form>
</body>
</html>

169
indexes/manage/edit.php Normal file
View File

@ -0,0 +1,169 @@
<link rel="stylesheet" href="../../index.css" type="text/css" />
<script src="../../home.js"></script>
<style>
body{
overflow: auto;
}
</style>
<?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'] === 'admin') {
$sql = "SELECT * FROM inventory";
$result = mysqli_query($conn, $sql);
$row = mysqli_num_rows($result);
if ($row <= 0) {
echo '<h3>Nothing Here</h3>';
}
//buttons
echo '<br><br><br><br><br><br><br><br>';
echo '<div id="grid">';
echo '<table style="text-align: left;">';
echo '<tr>';
echo "<td><button id='addfruit' onclick='addfruit()'>ADD</button></td>";
echo "<td width='20px'></td>";
echo '<form action="update.php" method="POST">';
echo "<td><button id='update' type='submit' style='text-align: center;'>SAVE</button></td>";
echo '</tr>';
echo '</table>';
//modify area
while ($row_data = mysqli_fetch_array($result)) {
echo '<table id="items" style="text-align: center;">';
echo '<tr>';
echo '<th>Image </th>';
echo '<td colspan="2">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($row_data['img']) . '" title="' . $row_data['name'] . '" id="' . $row_data['name'] . '" style="width:30%" onclick="changeimg(this)">';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th width="40%">Name </th>';
echo '<td width="60%" colspan="2">';
echo '<input name="data['.$row_data['name'].'][name]" value="'.$row_data['name'].'" style="width: 90%;">';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Short description </th>';
echo '<td colspan="2">';
echo '<textarea name="data['.$row_data['name'].'][simpledesc]">'.$row_data['simpledesc'].'</textarea>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Full description </th>';
echo '<td style="overflow: auto;" colspan="2">';
echo '<textarea name="data['.$row_data['name'].'][fulldesc]">'.$row_data['fulldesc'].'</textarea>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Inventory </th>';
echo '<td width="max-content">';
echo '<input name="data['.$row_data['name'].'][quantities]" value="'.$row_data['quantities'].'">';
echo '</td>';
echo '<td>kg</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Buyer price </th>';
echo '<td>¥</td>';
echo '<td width="max-content">';
echo '<input name="data['.$row_data['name'].'][buyer_price]" id="buyer_price" value="'.$row_data['buyer_price'].'">';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Seller price </th>';
echo '<td>¥</td>';
echo '<td width="max-content">';
echo '<input name="data['.$row_data['name'].'][seller_price]" id="seller_price" value="'.$row_data['seller_price'].'">';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<th>buyer availability </th>';
echo '<td><input type="radio" name="data['.$row_data['name'].'][buyer_availability]" value="1" '.($row_data['buyer_availability'] == '1' ? 'checked' : '').'></td>';
echo '<td><input type="radio" name="data['.$row_data['name'].'][buyer_availability]" value="0" '.($row_data['buyer_availability'] == '0' ? 'checked' : '').' ></td>';
echo '</tr>';
echo '<tr>';
echo '<td></td>';
echo '<td>available</td>';
echo '<td>not available</td>';
echo '</tr>';
echo '<tr>';
echo '<th>Seller availability </th>';
echo '<td><input type="radio" name="data['.$row_data['name'].'][seller_availability]" value="1" '.($row_data['seller_availability'] == '1' ? 'checked' : '').' ></td>';
echo '<td><input type="radio" name="data['.$row_data['name'].'][seller_availability]" value="0" '.($row_data['seller_availability'] == '0' ? 'checked' : '').' ></td>';
echo '</tr>';
echo '<tr>';
echo '<td></td>';
echo '<td>available</td>';
echo '<td>not available</td>';
echo '</tr>';
echo '<tr>';
echo '<td colspan="3" id="' . $row_data['name'] . '" onclick="deletefruit(this)" style="cursor: hand; text-align: center; color: white; background-color: red; border-radius: 10px">DELETE</td>';
echo '</tr>';
echo '<input type="hidden" name="data['.$row_data['name'].'][id]" value="'.$row_data['name'].'">';
echo '</table>';
}
echo '</form>';
echo '</div>';
}
else {
echo "<script type='text/javascript'>
alert('Only admin can visit!');
</script>";
}
}
else {
echo "<script type='text/javascript'>
window.location.href = '../../index.html';
</script>";
}
echo '<dialog class="dialog">';
echo'<form method="dialog">';
echo'<p>Are you sure to delete this fruit?</p>';
echo'<br>';
echo'<button class="dialogbutton" type="submit" value="Yes">Yes</button>';
echo'&nbsp&nbsp&nbsp';
echo'<button class="dialogbutton" id="cancel-button">No</button>';
echo'</form>';
echo'<br>';
echo'</dialog>';
mysqli_close($conn);
?>
<script>
function addfruit(){
makeIFrame("./fruit_add.php", "login", "overlay");
}
function deletefruit(tag){
var name = tag.id;
var dialog = document.querySelector('dialog');
dialog.showModal();
dialog.addEventListener('close', function(event) {
var targetButton = event.target.returnValue;
if (targetButton === "Yes") {
window.location.href = "fruit_del.php?name=" + name;
}
});
}
function changeimg(tag) {
var name = tag.id;
makeIFrame("./changeimg.php?name=" + name, "login", "overlay");
}
</script>

View File

@ -0,0 +1,131 @@
<link rel="stylesheet" href="../../index.css" type="text/css" />
<script src="../../home.js"></script>
<html>
<head>
<title>Add Fruit</title>
<style>
body {
align-items: center;
height: 100%;
width: 99%;
z-index: 1;
overflow-x: hidden;
overflow-y: auto;
background-image: none;
}
</style>
</head>
<body>
<h1>Add Fruit</h1>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Check if the form was submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Include the database connection file
include '../ConnectDB.php';
// Read the uploaded image file
$image = $_FILES["image"]["tmp_name"];
$imageData = addslashes(file_get_contents($image));
// Check if the uploaded file is an image
$mime = mime_content_type($image);
$allowedMimeTypes = ['image/jpeg', 'image/png', 'image/gif'];
if (!in_array($mime, $allowedMimeTypes)) {
die("Invalid file format. Only JPEG, PNG, and GIF images are allowed.");
}
// Check if the file size is within limits
$maxFileSize = 1024 * 1024; // 1 MB
if ($_FILES["image"]["size"] > $maxFileSize) {
die("File size exceeds the limit. Maximum allowed size is 1 MB.");
}
// Sanitize user input
$name = mysqli_real_escape_string($conn, $_POST["name"]);
$simpledesc = mysqli_real_escape_string($conn, $_POST["simpledesc"]);
$fulldesc = mysqli_real_escape_string($conn, $_POST["fulldesc"]);
$quantities = mysqli_real_escape_string($conn, $_POST["quantities"]);
$buyer_price = mysqli_real_escape_string($conn, $_POST["buyer_price"]);
$seller_price = mysqli_real_escape_string($conn, $_POST["seller_price"]);
$buyer_availability = mysqli_real_escape_string($conn, $_POST["buyer_availability"]);
$seller_availability = mysqli_real_escape_string($conn, $_POST["seller_availability"]);
// Insert data into the database
$sql_add_inventory = "INSERT INTO `inventory` (`name`, `img`, `simpledesc`, `fulldesc`, `quantities`, `buyer_price`, `seller_price`, `buyer_availability`, `seller_availability`) VALUES ('$name', '$imageData', '$simpledesc', '$fulldesc', '$quantities', '$buyer_price', '$seller_price', '$buyer_availability', '$seller_availability')";
$sql_add_buyer = "ALTER TABLE `buyer` ADD `$name` INT NOT NULL DEFAULT '0'";
$sql_add_seller = "ALTER TABLE `seller` ADD `$name` INT NOT NULL DEFAULT '0'";
// Execute the SQL statements
$res_1 = mysqli_query($conn, $sql_add_inventory);
$res_2 = mysqli_query($conn, $sql_add_buyer);
$res_3 = mysqli_query($conn, $sql_add_seller);
// Check if any query failed
if ($res_1 && $res_2 && $res_3) {
echo "Inventory added successfully!";
} else {
echo "Error adding inventory. Please try again.";
}
}
?>
<form method="POST" action="" enctype="multipart/form-data" onsubmit="return checkprice()">
<table style="text-align: right;">
<tr>
<td><label for="name">Name:</label></td>
<td colspan="3"><input type="text" id="name" name="name" required></td>
</tr>
<tr>
<td><label for="img">Img:</label></td>
<td width="0%"><input type="file" name="image" accept="image/*" required></td>
</tr>
<tr>
<td><label for="simpledesc">Simple Description:</label></td>
<td colspan="3"><textarea id="simpledesc" name="simpledesc" required></textarea></td>
</tr>
<tr>
<td><label for="fulldesc">Full Description:</label></td>
<td colspan="3"><textarea id="fulldesc" name="fulldesc" required></textarea></td>
</tr>
<tr>
<td><label for="quantities">Quantities (kg):</label></td>
<td colspan="3"><input type="number" id="quantities" name="quantities" required></td>
</tr>
<tr>
<td><label for="buyer_price">Buyer Price:</label></td>
<td colspan="3"><input type="number" id="buyer_price" name="buyer_price" required></td>
</tr>
<tr>
<td><label for="seller_price">Seller Price:</label></td>
<td colspan="3"><input type="number" id="seller_price" name="seller_price" required></td>
</tr>
<tr>
<td><label for="buyer_availability">Buyer Availability (available: 1, not available: 0):</label></td>
<td colspan="3"><input type="number" id="buyer_availability" name="buyer_availability" required></td>
</tr>
<tr>
<td><label for="seller_availability">Seller Availability (available: 1, not available: 0):</label></td>
<td colspan="3"><input type="number" id="seller_availability" name="seller_availability" required></td>
</tr>
<tr>
<td colspan="2"><button type="submit">Add Inventory</button></td>
</tr>
</table>
</form>
<script>
function checkprice() {
var buyPrice = parseInt(document.getElementById("buyer_price").value);
var sellPrice = parseInt(document.getElementById("seller_price").value);
if (buyPrice < sellPrice) {
alert("Buyer price cannot be lower than seller price!");
return false;
}
}
</script>
</body>
<html>

View File

@ -0,0 +1,39 @@
<?php
include '../ConnectDB.php';
if(isset($_GET["name"])) {
$name = $_GET["name"];
// Delete from the inventory table
$sql_clear_inventory = "DELETE FROM inventory WHERE name='$name'";
$res_1 = mysqli_query($conn, $sql_clear_inventory);
if(!$res_1){
echo "<br><br><br><br><br><br><br><br>";
echo "Error deleting from inventory: " . mysqli_error($conn);
return;
}
// Drop the column from the buyer table
$sql_clear_buyer = "ALTER TABLE buyer DROP COLUMN `$name`";
$res_2 = mysqli_query($conn, $sql_clear_buyer);
if(!$res_2){
echo "<br><br><br><br><br><br><br><br>";
echo "Error dropping column from buyer table: " . mysqli_error($conn);
return;
}
// Drop the column from the seller table
$sql_clear_seller = "ALTER TABLE seller DROP COLUMN `$name`";
$res_3 = mysqli_query($conn, $sql_clear_seller);
if(!$res_3){
echo "<br><br><br><br><br><br><br><br>";
echo "Error dropping column from seller table: " . mysqli_error($conn);
return;
}
echo "<script type='text/javascript'>
alert('Successfully deleted!');
window.location.href = './edit.php';
</script>";
}
?>

View 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;
}

View 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 = '../admin.php';}, 600);
</script>
</div>
</body>
</html>

135
indexes/manage/overview.php Normal file
View File

@ -0,0 +1,135 @@
<link rel="stylesheet" href="../../index.css" type="text/css" />
<html>
<head>
<style>
textarea{
background-color: #00000000;
border: none;
border-radius: 12px;
outline: none;
font-size: 75%;
width: 100%;
height: max-content;
}
textarea:focus{
border: none;
}
body{
overflow: auto;
}
</style>
</head>
</html>
<?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'] === 'admin') {
echo '<br><br><br><br><br><br><br>';
//check cashflow
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$sql_sell_out = "SELECT details FROM buyer_receipt WHERE name='sell_out'";
$result = mysqli_query($conn, $sql_sell_out);
$sell_out = mysqli_fetch_array($result);
$sql_buy_in = "SELECT details FROM seller_receipt WHERE name='buy_in'";
$result = mysqli_query($conn, $sql_buy_in);
$buy_in = mysqli_fetch_array($result);
$profit = $sell_out['details'] - $buy_in['details'];
echo "<h2 style='text-align: center; color: white;'>Cash Flow: ¥".$profit."</h2>";
$sql = "SELECT * FROM inventory";
$result = mysqli_query($conn, $sql);
$row = mysqli_num_rows($result);
if($row <= 0){
echo '<h2>Nothing Here</h2>';
return;
}
echo '<div id="grid">';
for ($i = 0; $i < $row; $i++) {
//get number of columns
$fields = mysqli_num_fields($result);
//Get each row data and display
while ($row_data = mysqli_fetch_array($result)){
echo '<table id="items" style="text-align: left;">';
echo '<tr>';
echo '<th>Image </th>';
echo '<td colspan="2">
<img src="data:image/jpeg;base64,' . base64_encode($row_data['img']) . '" title="' . $row_data['imgname'] . '" id="' . $row_data['name'] . '" onclick="details(this)"
style="width:30%"></td>';
echo '</tr>';
echo "<tr>";
echo "<th width='40%'>Name </th>";
echo "<td width='60%' colspan='2'>".$row_data['name']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th>Short description </th>";
echo "<td colspan='2'>".$row_data['simpledesc']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th width='40%'>Full description </th>";
echo "<td width='60%' style='overflox: auto;' colspan='2'><textarea readonly>"
.$row_data['fulldesc']."</textarea></td>";
echo "</tr>";
echo "<tr>";
echo "<th width='40%'>Inventory </th>";
echo "<td windth='max-content'>".$row_data['quantities']." kg</td>";
echo "</tr>";
echo "<tr>";
echo "<th width='40%'>Buyer price </th>";
echo "<td windth='max-content'>¥ ".$row_data['buyer_price']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th>Seller price </th>";
echo "<td windth='max-content'>¥ ".$row_data['seller_price']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th>buyer availability </th>";
if($row_data['buyer_availability'] == '1'){
echo "<td>available</td>";
}
else{
echo "<td>not available</td>";
}
echo "</tr>";
echo "<tr>";
echo "<th>Seller availability </th>";
if($row_data['seller_availability'] == '1'){
echo "<td>available</td>";
}
else{
echo "<td>not available</td>";
}
echo "</tr>";
echo "</table>";
}
}
echo '</div>';
}
else{
echo "<script type='text/javascript'>
alert('Only admin can visit!');
</script>";
}
}
else{
echo "<script type='text/javascript'>
window.location.href = '../../index.html';
</script>";
}
?>

63
indexes/manage/update.php Normal file
View File

@ -0,0 +1,63 @@
<?php
include "../ConnectDB.php";
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the submitted form data
$formData = $_POST['data'];
// Process each item's form data
foreach ($formData as $itemName => $itemData) {
$id = $itemData['id'];
$name = $itemData['name'];
$simpledesc = $itemData['simpledesc'];
$fulldesc = $itemData['fulldesc'];
$quantities = $itemData['quantities'];
$buyer_price = $itemData['buyer_price'];
$seller_price = $itemData['seller_price'];
$buyer_availability = $itemData['buyer_availability'];
$seller_availability = $itemData['seller_availability'];
if($buyer_price < $seller_price){
echo "<br><br><br><br><br><br>";
echo "<h1>The buyer price of $id cannot be lower than its seller price!</h1>";
echo "<script type='text/javascript'>
setTimeout(function() {window.location.href = './edit.php';}, 1000);
</script>";
exit();
}
// Prepare and execute the update query
$stmt = mysqli_prepare($conn, "UPDATE inventory SET name=?, simpledesc=?, fulldesc=?, quantities=?, buyer_price=?, seller_price=?, buyer_availability=?, seller_availability=? WHERE name=?");
mysqli_stmt_bind_param($stmt, "sssssssss", $name, $simpledesc, $fulldesc, $quantities, $buyer_price, $seller_price, $buyer_availability, $seller_availability, $id);
mysqli_stmt_execute($stmt);
$sql_buyer_name = "ALTER TABLE `buyer` CHANGE `$id` `$name` INT(11) NOT NULL DEFAULT '0'";
$res_1 = mysqli_query($conn, $sql_buyer_name);
$sql_seller_name = "ALTER TABLE `seller` CHANGE `$id` `$name` INT(11) NOT NULL DEFAULT '0'";
$res_2 = mysqli_query($conn, $sql_seller_name);
// Check if the update was successful
if (mysqli_stmt_affected_rows($stmt) > 0 && $res_1 && $res_2) {
//echo "Data updated successfully.";
echo "<script type='text/javascript'>
window.location.href = './interfaces/success.php';
</script>";
} else {
if(mysqli_stmt_error($stmt) || !$res_1 || !$res_2){
echo "<script type='text/javascript'>
alert('Failed to update data.');
window.location.href = './edit.php';
</script>";
}
}
echo "<script type='text/javascript'>
window.location.href = './interfaces/success.php';
</script>";
// Close the statement
mysqli_stmt_close($stmt);
}
}
?>

View File

@ -0,0 +1,58 @@
<?php
include "../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if($usertype == "seller"){
$a = "seller_availability";
}
else{
$a = "buyer_availability";
}
if(isset($_GET["name"], $_GET["quantity"])) {
$name = $_GET["name"];
$quantity = $_GET["quantity"];
//if get null value
if($quantity == ""){
echo "<script type='text/javascript'>
window.top.location.href = '../../home.php';
</script>";
return;
}
$check_sql = "SELECT $a FROM inventory WHERE name = '$name'";
$res = mysqli_query($conn, $check_sql);
$avail = mysqli_fetch_array($res);
//if not available
if($avail[$a] != 1){
echo "<script type='text/javascript'>
alert('This fruit is currently unavailable!');
window.top.location.href = '../../home.php';
</script>";
return;
}
$sql_quant = "SELECT $name FROM $usertype WHERE name='$username'";
$res = mysqli_query($conn, $sql_quant);
if ($res) {
$num = mysqli_fetch_array($res);
//if seller tries to sell more than 100kg fruits
if(($usertype == "seller" && $num[$name] + $quantity <= 100) || $usertype == "buyer"){
$add = "UPDATE $usertype SET $name = $name+$quantity WHERE name='$username'";
$res = mysqli_query($conn, $add);
}
else{
echo "<script type='text/javascript'>
alert('You can only sell 100kg/type fruit one time!');
window.top.location.href = '../../home.php';
</script>";
return;
}
}
}
header('Location: ./interfaces/success.php');
?>

148
indexes/process/cart.css Normal file
View File

@ -0,0 +1,148 @@
#grid{
position:absolute;
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;
}
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);
}
img: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;
}
body{
height: 100%;
width: 99%;
z-index: 1;
align-items: center;
overflow-x: hidden;
}
/* Hide scrollbar when not needed */
body::-webkit-scrollbar {
width: 0.5em;
}
body::-webkit-scrollbar-thumb {
width: 0.5em;
background: linear-gradient(rgba(109, 103, 103, 0.6), #00000000);
border-radius: 0.25em;
}
#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;
}

View File

@ -0,0 +1,129 @@
<html>
<head>
<title>Online Fruit Store</title>
<script src="iframe.js"></script>
<script src="item_modify.js"></script>
<link rel="stylesheet" href="./cart.css" type="text/css" />
</head>
<body>
<br><br><br><br><br><br><br>
<div id="grid">
<?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"){
$a = "seller_availability";
$sql_col = "DESCRIBE seller";
$m = "seller_price";
}
else{
$a = "buyer_availability";
$sql_col = "DESCRIBE buyer";
$m = "buyer_price";
}
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
$res = mysqli_query($conn, $sql_col);
// Extract column names into an array
$col_name = array();
while ($row = mysqli_fetch_array($res)) {
$col_name[] = $row['Field'];
}
$sql_cart = "SELECT * FROM $usertype WHERE name='$username'";
$result = mysqli_query($conn, $sql_cart);
$col = mysqli_num_fields($result);
$goods = mysqli_fetch_array($result);
$total = 0;
for ($i = 3; $i < $col; $i++) {
//check availability
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$check_sql = "SELECT $a FROM inventory WHERE name = '$col_name[$i]'";
$res = mysqli_query($conn, $check_sql);
$avail = mysqli_fetch_array($res);
if($avail[$a] == 0 && $avail[$a] != null){
echo "<script type='text/javascript'>
alert('$col_name[$i] is currently unavailable!');
</script>";
}
if($goods[$i] > 0){
$col_name_i = mysqli_real_escape_string($conn, $col_name[$i]);
//display image
$sql_img = "SELECT img FROM inventory WHERE name='$col_name_i'";
$picaddress = mysqli_query($conn, $sql_img);
$img = mysqli_fetch_array($picaddress);
//get item
$sql_price = "SELECT $m FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//unit price
$unitprice = $price[$m];
//total price
$total += $unitprice * $goods[$i];
//display
echo '<table id="items">';
echo '<tr>';
echo '<td width="20%">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($img['img']) . '" title="' . $col_name[$i] . '" id="' . $col_name[$i] . '" onclick="details(this)">';
echo '</td>';
echo '<td width="20%">';
echo '<h4 style="margin: 0%;">' . $col_name[$i] . '</h4>';
echo '</td>';
echo '<td width="24%" id="icon">';
echo '<p>¥'.$unitprice.'</p>';
echo '</td>';
echo '<td width="6%" id="icon">';
echo '<img src="../../icon/add.svg" id="' . $col_name[$i] . '" onclick="item_add(this)">';
echo '</td>';
echo '<td width="8%">';
echo '<input type="text" style="margin: 0%;" id="' . $col_name[$i] . '" value="' . $goods[$i] . '" onfocusout="item_modify(this)">';
echo '</td>';
echo '<td width="6%" id="icon">';
echo '<img src="../../icon/subtract.svg" id="' . $col_name[$i] . '" onclick="item_subtract(this)">';
echo '</td>';
echo '<td width="6%" id="icon">';
echo '<img src="../../icon/del.svg" id="' . $col_name[$i] . '" onclick="item_del(this)">';
echo '</td>';
echo '</tr>';
echo '</table>';
}
}
if($total != 0){
echo '<br>';
echo '<table width="20%" style="text-align: center;">';
echo '<tr>';
echo '<td><h1>Total Price: ¥ '.$total.'</h1></td>';
echo '</tr>';
echo '<tr>';
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>';
}
}
?>
</div>
</body>
</html>

149
indexes/process/checkup.php Normal file
View File

@ -0,0 +1,149 @@
<html>
<head>
<title>Online Fruit Store</title>
<link rel="stylesheet" href="./cart.css" type="text/css" />
<script src="./item_modify.js"></script>
<style>
button {
height: 32px;
width: 300px;
border: none;
background: linear-gradient(to right, rgb(26, 117, 172), rgb(26, 158, 144));
color: white;
cursor: pointer;
box-shadow: 0px 0px 0px #424242;
transition: 0.3s;
border-radius: 5px;
}
</style>
</head>
<body>
<br><br><br><br>
<div id="grid">
<?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") {
$a = "seller_availability";
$sql_col = "DESCRIBE seller";
$m = "seller_price";
} else {
$a = "buyer_availability";
$sql_col = "DESCRIBE buyer";
$m = "buyer_price";
}
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
// Get column names from the buyer table
$res = mysqli_query($conn, $sql_col);
// Extract column names into an array
$col_name = array();
while ($row = mysqli_fetch_array($res)) {
$col_name[] = $row['Field'];
}
$sql_cart = "SELECT * FROM $usertype WHERE name='$username'";
$result = mysqli_query($conn, $sql_cart);
//get column number
$col = mysqli_num_fields($result);
//get goods
$goods = mysqli_fetch_array($result);
$total = 0;
//sub-banner
echo '<table id="items" style="align-items: center; width: 98.5%; height: 5%;">';
echo '<tr>';
echo '<th width="30%">Image</th>';
echo '<th width="20%">Fruit</th>';
echo '<th width="30%">Unit-price</th>';
echo '<th width="20%">Order</th>';
echo '</tr>';
echo '</table>';
for ($i = 3; $i < $col; $i++) {
//check availability
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$check_sql = "SELECT $a FROM inventory WHERE name = '$col_name[$i]'";
$res = mysqli_query($conn, $check_sql);
$avail = mysqli_fetch_array($res);
if ($avail[$a] == 0 && $avail[$a] !== null) {
echo "<script type='text/javascript'>
alert('$col_name[$i] is currently unavailable!');
</script>";
}
if ($goods[$i] > 0) {
//display image
$sql_img = "SELECT img FROM inventory WHERE name='$col_name[$i]'";
$picaddress = mysqli_query($conn, $sql_img);
$img = mysqli_fetch_array($picaddress);
//get unit price
$sql_price = "SELECT $m FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//unit price
$unitprice = $price[$m];
//total price
$total += $unitprice * $goods[$i];
//display
echo '<table id="items">';
echo '<tr>';
echo '<td width="24%">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($img['img']) . '" title="' . $col_name[$i] . '" id="' . $col_name[$i] . '"">';
echo '</td>';
echo '<td width="24%">';
echo '<h4 style="margin: 0%;">' . $col_name[$i] . '</h4>';
echo '</td>';
echo '<td width="24%" id="icon">';
echo '<p>¥'.$unitprice.'</p>';
echo '</td>';
echo '<td width="8%" id="icon">';
echo '<img src="../../icon/add.svg" id="' . $col_name[$i] . '" onclick="item_checkup_add(this)">';
echo '</td>';
echo '<td width="12%">';
echo '<input type="text" style="margin: 0%;" id="' . $col_name[$i] . '" value="' . $goods[$i] . '" onblur="item_checkup_modify(this)">';
echo '</td>';
echo '<td width="8%" id="icon">';
echo '<img src="../../icon/subtract.svg" id="' . $col_name[$i] . '" onclick="item_checkup_subtract(this)">';
echo '</td>';
echo '</tr>';
echo '</table>';
}
}
echo '<br>';
echo '<table width="20%" style="text-align: center;">';
echo '<tr>';
echo '<td><h1>Total Price: ¥ '.$total.'</h1></td>';
echo '</tr>';
echo '<td>';
echo '<form action="./order.php" method="POST">';
if($usertype == 'buyer'){
echo '<button type="submit">Order</button>';
}
else{
echo '<button type="submit">Sell</button>';
}
echo '</form>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
?>
</div>
</body>
</html>

View File

@ -0,0 +1,113 @@
<link rel="stylesheet" href="./cart.css" type="text/css" />
<?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") {
$a = "seller_availability";
$m = "seller_price";
}
else {
$a = "buyer_availability";
$m = "buyer_price";
}
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
if (isset($_GET["name"], $_GET["quantity"])) {
echo '<br><br><br><br>';
//check availability
if($_GET["quantity"] > 100 && $usertype == "seller"){
echo "<script type='text/javascript'>
alert('You can only sell 100kg/type fruit one time!');
window.top.location.href = '../../home.php';
</script>";
exit();
}
$name = mysqli_real_escape_string($conn, $_GET["name"]);
$check_sql = "SELECT $a FROM inventory WHERE name = '$name'";
$res = mysqli_query($conn, $check_sql);
$avail = mysqli_fetch_array($res);
if ($avail[$a] == 0 && $avail[$a] !== null) {
$errorMessage = $_GET["name"] . " is currently unavailable";
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=" . urlencode($errorMessage) . "';
</script>";
exit();
}
//get image
$sql_img = "SELECT img FROM inventory WHERE name='$name'";
$picaddress = mysqli_query($conn, $sql_img);
$img = mysqli_fetch_array($picaddress);
//get unit price
$sql_price = "SELECT $m FROM inventory WHERE name='$name'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//get unit total price
$fruitprice = $price[$m] * $_GET["quantity"];
//display
echo '<table id="items" style="align-items: center; width: 98.5%;">';
echo '<tr>';
echo '<th width="30%">Image</th>';
echo '<th width="30%">Fruit</th>';
echo '<th width="20%">Order</th>';
echo '<th width="20%">Unit-price</th>';
echo '</tr>';
echo '</table>';
echo '<table id="items" style="align-items: center; width: 98.5%;">';
echo '<tr>';
echo '<td width="30%">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($img['img']) . '" title="' . $name . '" id="' . $name . '">';
echo '</td>';
echo '<td width="30%">';
echo '<h4 style="margin: 0%;">' . $name . '</h4>';
echo '</td>';
echo '<td width="20%">';
echo '<p style="margin: 0%;" id="' . $name . '">' . $_GET["quantity"] . ' kg</p>';
echo '</td>';
echo '<td width="20%">';
echo '<p style="margin: 0%;">¥'.$price[$m].'/kg</p>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<br>';
echo '<table style="text-align: center;" width="100%">';
echo '<tr>';
echo '<td><h1>Total Price: ¥ '.$fruitprice.'</h1></td>';
echo '</tr>';
echo '<td>';
$urlParams = "name=" . urlencode($_GET["name"]) . "&amount=" . urlencode($_GET["quantity"]); // URL-encode the parameters
echo '<form action="./ordernow.php?' . $urlParams . '" method="POST">';
if ($usertype == 'buyer') {
echo '<button type="submit">Order</button>';
}
else {
echo '<button style="align-items: center; width: 98.5%;" type="submit">Sell</button>';
}
echo '</form>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
else{
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Unknown Error Occurred';
</script>";
}
}
?>

45
indexes/process/iframe.js Normal file
View 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);
}
}

View File

@ -0,0 +1,94 @@
<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">';
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>

View 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';}, 1200);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
#area{
position: absolute;
text-align: center;
width: 45%;
left: 0;
top: 12%;
right: 0;
bottom: 0;
margin: auto;
user-select: none;
font-family: Arial, Helvetica, sans-serif;
}
img{
width: 40%;
height: 40%;
margin: none;
}

View File

@ -0,0 +1,76 @@
<html>
<head>
<title>Success</title>
<style>
td{
font-size: small;
}
th{
font-size: small;
}
</style>
<link rel="stylesheet" href="../cart.css" type="text/css" />
<link rel="stylesheet" href="./instruct.css" type="text/css" />
</head>
<body>
<div id="area">
<img style="margin:0%;" onclick="gotohome()" src="../../../icon/check.svg">
<h1>Success</h1>
<h3 onclick="gotohome()" style="cursor: hand; color: green;">return home</h3>
<?php
if(isset($_GET["details"], $_GET["total"], $_GET["date"])) {
echo '<div id="grid">';
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("|", $_GET["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>".$_GET["date"]."</td>";
echo "<td>¥".$_GET["total"]."</td>";
echo '</tr>';
echo "</table>";
}
echo '</div>';
?>
</div>
<script>
function gotohome(){
window.top.location.href = '../../../home.php';
}
</script>
</body>
</html>

View 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 = '../../../home.php';}, 600);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,149 @@
<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";
}
$sql="SELECT * FROM inventory WHERE name = '".$_GET['myParam']."' ";
$res = mysqli_query($conn, $sql);
$goods = mysqli_fetch_assoc($res);
?>
<div id="area">
<table>
<tr>
<td width="50%" style="text-align: right;">
<img src="data:image/jpeg;base64,<?php echo base64_encode($goods['img']); ?>" 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 &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 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>

View File

@ -0,0 +1,36 @@
function item_add(tag){
var name = tag.id;
window.location.href = "./modify/item_add.php?name=" + name;
}
function item_subtract(tag){
var name = tag.id;
window.location.href = "./modify/item_subtract.php?name=" + name;
}
function item_del(tag){
var name = tag.id;
window.location.href = "./modify/item_del.php?name=" + name;
}
function item_modify(tag){
var name = tag.id;
var quantity = tag.value;
window.location.href = "./modify/item_modify.php?name=" + name + "&quantity=" + quantity;
}
function item_checkup_add(tag){
var name = tag.id;
window.location.href = "./modify/item_checkup_add.php?name=" + name;
}
function item_checkup_subtract(tag){
var name = tag.id;
window.location.href = "./modify/item_checkup_subtract.php?name=" + name;
}
function item_checkup_modify(tag){
var name = tag.id;
var quantity = tag.value;
window.location.href = "./modify/item_checkup_modify.php?name=" + name + "&quantity=" + quantity;
}

View File

@ -0,0 +1,33 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if(isset($_GET["name"])) {
$name = $_GET["name"];
//seller cannot add more than 100kg
if($usertype == "seller"){
$sql_check = "SELECT $name FROM seller WHERE name='$username'";
$res = mysqli_query($conn, $sql_check);
$num = mysqli_fetch_array($res);
if($num[$name] + 1 > 100){
echo "<script type='text/javascript'>
alert('You cannot sell more than 100kg/fruit one time!');
window.location.href = '../cart_index.php';
</script>";
exit();
}
}
$add = "UPDATE $usertype SET $name = $name + 1 WHERE name='$username'";
$res = mysqli_query($conn, $add);
if(!$res){
echo "<script type='text/javascript'>
alert('Error occurred!');
</script>";
}
}
header('Location: ../cart_index.php');
?>

View File

@ -0,0 +1,34 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if(isset($_GET["name"])) {
$name = $_GET["name"];
//seller cannot add more than 100kg
//seller cannot add more than 100kg
if($usertype == "seller"){
$sql_check = "SELECT $name FROM seller WHERE name='$username'";
$res = mysqli_query($conn, $sql_check);
$num = mysqli_fetch_array($res);
if($num[$name] + 1 > 100){
echo "<script type='text/javascript'>
alert('You cannot sell more than 100kg/fruit one time!');
window.location.href = '../cart_index.php';
</script>";
exit();
}
}
$add = "UPDATE $usertype SET $name = $name + 1 WHERE name='$username'";
$res = mysqli_query($conn, $add);
if(!$res){
echo "<script type='text/javascript'>
alert('Error occurred!');
</script>";
}
}
header('Location: ../checkup.php');
?>

View File

@ -0,0 +1,34 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if (isset($_GET["name"], $_GET["quantity"])) {
if ($_GET["quantity"] > 0 && ($_GET["quantity"] <= 100 || $usertype == "buyer")) {
$quantity = $_GET["quantity"];
$name = mysqli_real_escape_string($conn, $_GET["name"]);
$add = "UPDATE $usertype SET `$name` = $quantity WHERE name='$username'";
$res = mysqli_query($conn, $add);
if (!$res) {
echo "<script type='text/javascript'>
alert('Error occurred!');
</script>";
}
}
else if ($_GET["quantity"] > 100 && $usertype == "seller") {
echo "<script type='text/javascript'>
alert('You can only buy 100kg of each type of fruit at a time!');
</script>";
}
else{
echo "<script type='text/javascript'>
alert('You cannot buy nothing!');
</script>";
}
}
echo "<script type='text/javascript'>
window.location.href = '../checkup.php';
</script>";
?>

View File

@ -0,0 +1,34 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if (isset($_GET["name"])) {
$name = $_GET["name"];
$sql_quant = "SELECT $name FROM $usertype WHERE name='$username'";
$res = mysqli_query($conn, $sql_quant);
if ($res) {
$num = mysqli_fetch_array($res);
if ($num[$name] > 1) {
$add = "UPDATE $usertype SET `$name` = `$name` - 1 WHERE name='$username'";
$res = mysqli_query($conn, $add);
}
else {
echo "<script type='text/javascript'>
alert('You cannot buy for nothing!');
</script>";
}
}
else {
// Handle the SQL query error
echo "Error: " . mysqli_error($conn);
}
}
echo "<script type='text/javascript'>
window.location.href = '../checkup.php';
</script>";
?>

View File

@ -0,0 +1,14 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if(isset($_GET["name"])) {
$name = $_GET["name"];
$add = "UPDATE $usertype SET $name = 0 WHERE name='$username'";
$res = mysqli_query($conn, $add);
}
header('Location: ../cart_index.php');
?>

View File

@ -0,0 +1,23 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if(isset($_GET["name"], $_GET["quantity"])) {
$name = $_GET["name"];
$quantity = $_GET["quantity"];
if(($usertype == "seller" && $quantity >= 0 && $quantity <= 100) || ($usertype == "buyer" && $quantity >= 0)){
$add = "UPDATE $usertype SET $name = $quantity WHERE name='$username'";
$res = mysqli_query($conn, $add);
}
else{
echo "<script type='text/javascript'>
alert('Please input a valid amount of fruit!');
</script>";
}
}
header('Location: ../cart_index.php');
?>

View File

@ -0,0 +1,13 @@
<?php
include "../../ConnectDB.php";
session_start();
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if(isset($_GET["name"])) {
$name = $_GET["name"];
$add = "UPDATE $usertype SET $name = $name-1 WHERE name='$username'";
$res = mysqli_query($conn, $add);
}
header('Location: ../cart_index.php');
?>

172
indexes/process/order.php Normal file
View File

@ -0,0 +1,172 @@
<?php
include "../ConnectDB.php";
// Start the session
session_start();
// Escape the username and user type for security
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
// Define table and column names based on the user type
if ($usertype == 'seller') {
$a = "seller_availability";
$m = "seller_price";
$r = "seller_receipt";
$sql_col = "DESCRIBE seller";
$c = "profit";
} else {
$a = "buyer_availability";
$m = "buyer_price";
$r = "buyer_receipt";
$sql_col = "DESCRIBE buyer";
$c = "money";
}
// Get column names from the buyer/seller table
$res = mysqli_query($conn, $sql_col);
// Extract column names into an array
$col_name = array();
while ($row = mysqli_fetch_array($res)) {
$col_name[] = $row['Field'];
}
// Retrieve the user's cart items
$sql_cart = "SELECT * FROM $usertype WHERE name='$username'";
$result = mysqli_query($conn, $sql_cart);
$col = mysqli_num_fields($result);
$goods = mysqli_fetch_array($result);
$details = "";
$total = 0;
for ($i = 3; $i < $col; $i++) {
if ($goods[$i] > 0) {
$sql_check_availability = "SELECT $a FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_check_availability);
$avail = mysqli_fetch_array($res);
if ($avail[$a] != 1) {
// Handle unavailability case (e.g., display an error message)
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Item \'$col_name[$i]\'. is currently unavailable';
</script>";
exit();
}
//get inventory
$sql_check_inventory = "SELECT quantities FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_check_inventory);
$inventory = mysqli_fetch_array($res);
//if sufficient inventory
if ($inventory['quantities'] >= $goods[$i] || $usertype == "seller") {
$sql_price = "SELECT $m FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//unit price
$fruitprice = $price[$m] * $goods[$i];
//total price
$total += $fruitprice;
}
else {
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Insufficient inventory for item \'$col_name[$i]\'.';
</script>";
exit();
}
}
}
//if buyer donot have enough balance
$sql_checkmoney = "SELECT $c FROM $usertype WHERE name='$username'";
$res = mysqli_query($conn, $sql_checkmoney);
$balance = mysqli_fetch_array($res);
if($balance[$c] < $total && $usertype == "buyer"){
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Insufficient Balance';
</script>";
exit();
}
//check cashflow
$sql_sell_out = "SELECT details FROM buyer_receipt WHERE name='sell_out'";
$result = mysqli_query($conn, $sql_sell_out);
$sell_out = mysqli_fetch_array($result);
$sql_buy_in = "SELECT details FROM seller_receipt WHERE name='buy_in'";
$result = mysqli_query($conn, $sql_buy_in);
$buy_in = mysqli_fetch_array($result);
$profit = $sell_out['details'] - $buy_in['details'];
//if insufficient cashflow
if($profit < $total && $usertype == "seller"){
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Insufficient Cashflow';
</script>";
exit();
}
else{
for ($i = 3; $i < $col; $i++) {
if ($goods[$i] > 0) {
//get price
$sql_price = "SELECT $m FROM inventory WHERE name='$col_name[$i]'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//unit total price
$fruitprice = $price[$m] * $goods[$i];
// Update the user's cart by setting the item quantity to 0
$sql_closecart = "UPDATE $usertype SET `$col_name[$i]` = 0 WHERE name='$username'";
$res = mysqli_query($conn, $sql_closecart);
// Update the inventory based on the user type
if ($usertype == 'buyer') {
$sql_update_inventory = "UPDATE inventory SET quantities = quantities - $goods[$i] WHERE name='$col_name[$i]'";
} else {
$sql_update_inventory = "UPDATE inventory SET quantities = quantities + $goods[$i] WHERE name='$col_name[$i]'";
}
$res = mysqli_query($conn, $sql_update_inventory);
// Create the details string for the receipt
$details .= "$col_name[$i]|$goods[$i]|$price[$m]|$fruitprice|";
}
}
}
// Get the current date and time in HK
$date = new DateTime('now');
$date->setTimezone(new DateTimeZone('Asia/Hong_Kong'));
$formattedDate = $date->format('Y-m-d H:i:s');
// Use the formatted date in your SQL query
$sql_add_receipt = "INSERT INTO `$r` (`name`, `details`, `total`, `date`) VALUES ('$username', '$details', '$total', '$formattedDate')";
$result = mysqli_query($conn, $sql_add_receipt);
// Deduct the total amount from the user's money
if($usertype == "buyer"){
$sql_money = "UPDATE buyer SET money = money - $total WHERE name='$username'";
$sql_profit = "UPDATE buyer_receipt SET details = details + $total WHERE name='sell_out'";
}
else{
$sql_money = "UPDATE seller SET profit = profit + $total WHERE name='$username'";
$sql_profit = "UPDATE seller_receipt SET details = details + $total WHERE name='buy_in'";
}
$result = mysqli_query($conn, $sql_money);
$result_profit = mysqli_query($conn, $sql_profit);
if ($result && $result_profit) {
echo "<script type='text/javascript'>
var details = '" . $details . "';
var total = '" . $total . "';
var date = '" . $formattedDate . "';
window.location.href = './interfaces/show_receipt.php?details=' + encodeURIComponent(details) + '&total=' + encodeURIComponent(total) + '&date=' + encodeURIComponent(date);
</script>";
}
else{
header('Location: ./interfaces/failed.php');
}
?>

View File

@ -0,0 +1,131 @@
<?php
include "../ConnectDB.php";
// Start the session
session_start();
// Escape the username and user type for security
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
// Define table and column names based on the user type
if ($usertype == 'seller') {
$a = "seller_availability";
$m = "seller_price";
$r = "seller_receipt";
$c = "profit";
}
else {
$a = "buyer_availability";
$m = "buyer_price";
$r = "buyer_receipt";
$c = "money";
}
if (isset($_GET["name"], $_GET["amount"])) {
$name = mysqli_real_escape_string($conn, $_GET["name"]);
//check availability
$check_sql = "SELECT $a FROM inventory WHERE name = '$name'";
$res = mysqli_query($conn, $check_sql);
$avail = mysqli_fetch_array($res);
if ($avail[$a] == 0 && $avail[$a] !== null) {
$errorMessage = urlencode("$name is currently unavailable");
header("Location: ./interfaces/failed.php?why=$errorMessage");
exit();
}
//get inventory
$sql_check_inventory = "SELECT quantities FROM inventory WHERE name = '$name'";
$res = mysqli_query($conn, $sql_check_inventory);
$inventory = mysqli_fetch_array($res);
//if sufficient inventery
if ($inventory['quantities'] >= $_GET["amount"] || $usertype == "seller") {
$sql_price = "SELECT $m FROM inventory WHERE name='$name'";
$res = mysqli_query($conn, $sql_price);
$price = mysqli_fetch_array($res);
//unit total price
$fruitprice = $price[$m] * $_GET["amount"];
//get user balance
$sql_checkmoney = "SELECT $c FROM $usertype WHERE name = '$username'";
$res = mysqli_query($conn, $sql_checkmoney);
$balance = mysqli_fetch_array($res);
//if buyer have no balance
if ($balance[$c] < $fruitprice && $usertype == "buyer") {
$errorMessage = urlencode("Insufficient Balance");
header("Location: ./interfaces/failed.php?why=$errorMessage");
exit();
}
//check cashflow
$sql_sell_out = "SELECT details FROM buyer_receipt WHERE name='sell_out'";
$result = mysqli_query($conn, $sql_sell_out);
$sell_out = mysqli_fetch_array($result);
$sql_buy_in = "SELECT details FROM seller_receipt WHERE name='buy_in'";
$result = mysqli_query($conn, $sql_buy_in);
$buy_in = mysqli_fetch_array($result);
$profit = $sell_out['details'] - $buy_in['details'];
//if insufficient cashflow
if($profit < $total && $usertype == "seller"){
echo "<script type='text/javascript'>
window.location.href = './interfaces/failed.php?why=Insufficient Cashflow';
</script>";
exit();
}
//update user balance
if ($usertype == 'buyer') {
$sql_update_inventory = "UPDATE inventory SET quantities = quantities - {$_GET["amount"]} WHERE name='$name'";
}
else {
$sql_update_inventory = "UPDATE inventory SET quantities = quantities + {$_GET["amount"]} WHERE name='$name'";
}
$res = mysqli_query($conn, $sql_update_inventory);
// Create the details string for the receipt
$details = "$name|{$_GET["amount"]}|$price[$m]|$fruitprice|";
// Get the current date and time in Hong Kong
$date = new DateTime('now', new DateTimeZone('Asia/Hong_Kong'));
$formattedDate = $date->format('Y-m-d H:i:s');
// Use the formatted date in your SQL query
$sql_add_receipt = "INSERT INTO `$r` (`name`, `details`, `total`, `date`) VALUES ('$username', '$details', '$fruitprice', '$formattedDate')";
$result = mysqli_query($conn, $sql_add_receipt);
// Deduct the total amount from the user's money
if ($usertype == "buyer") {
$sql_money = "UPDATE buyer SET money = money - $fruitprice WHERE name='$username'";
$sql_profit = "UPDATE buyer_receipt SET details = details + $fruitprice WHERE name='sell_out'";
} else {
$sql_money = "UPDATE seller SET profit = profit + $fruitprice WHERE name='$username'";
$sql_profit = "UPDATE seller_receipt SET details = details + $fruitprice WHERE name='buy_in'";
}
$result = mysqli_query($conn, $sql_money);
$result_profit = mysqli_query($conn, $sql_profit);
if ($result && $result_profit) {
echo "<script type='text/javascript'>
var details = '" . $details . "';
var total = '" . $fruitprice . "';
var date = '" . $formattedDate . "';
window.location.href = './interfaces/show_receipt.php?details=' + encodeURIComponent(details) + '&total=' + encodeURIComponent(total) + '&date=' + encodeURIComponent(date);
</script>";
}
else {
header('Location: ./interfaces/failed.php');
}
}
else {
$errorMessage = urlencode("Insufficient inventory for item '$name'");
header("Location: ./interfaces/failed.php?why=$errorMessage");
exit();
}
}
?>

View 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>';
?>

View File

@ -0,0 +1,213 @@
#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;
font-style: rgb(10, 22, 44);
user-select: none;
text-align: center;
align-items: left;
}
#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;
}
/* Hide scrollbar when not needed */
body::-webkit-scrollbar {
width: 0.5em;
}
body::-webkit-scrollbar-thumb {
width: 0.5em;
background: linear-gradient(rgba(109, 103, 103, 0.6), #00000000);
border-radius: 0.25em;
}
#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;
}

44
indexes/search/iframe.js Normal file
View File

@ -0,0 +1,44 @@
function details(tag){
var name = tag.id;
makeIFrame('../process/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);
}
}

134
indexes/search/search.css Normal file
View File

@ -0,0 +1,134 @@
#grid{
position:absolute;
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%;
font-family: Arial, Helvetica, sans-serif;
font-style: rgb(10, 22, 44);
user-select: none;
width: 80%;
height: 5vw;
transition: 0.3s;
}
img{
border-radius: 12px;
width:80%;
height: 80%;
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);
}
img:hover{
box-shadow: 0px 0px 10px rgb(106, 104, 104);
}
p,h5:hover{
cursor: hand;
}
input{
text-align: left;
margin-left: 2%;
font-size: 200%;
width: 96%;
background-color: #00000000;
border: none;
border-bottom: 2px solid black;
outline: none;
}
#detail_window{
position: absolute;
text-align: center;
/* 垂直居中 */
top: 0;
bottom: 0;
height: 100%;
/* 水平居中 */
left: 0%;
right: 0%;
width: 100%;
margin: auto;
user-select: none;
background-color: rgba(239, 230, 230, 0.5);
border: 0px;
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: 100000;
}
body{
height: 100%;
width: 99%;
z-index: 1;
}
/* Hide scrollbar when not needed */
body::-webkit-scrollbar {
width: 0.5em;
}
body::-webkit-scrollbar-thumb {
width: 0.5em;
background: #00000000;
border-radius: 0.25em;
}
#search_window{
width: 100%;
height: 100%;
border: none;
}
#closebutton{
position: absolute;
text-align: center;
transform: scale(1.6);
top: 2%;
height: 3%;
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;
}

32
indexes/search/search.php Normal file
View File

@ -0,0 +1,32 @@
<html>
<head>
<title>Search</title>
<script src="./iframe.js"></script>
<link rel="stylesheet" href="search.css" type="text/css" />
</head>
<body>
<br><br><br><br><br><br><br><br>
<div style="position: sticky;">
<input type="text" id="search" placeholder="search any fruit you want"
oninput="searchDB()">
</div>
<script>
var existence = document.getElementById("search_window");
if (!existence) {
// Create the iframe and add it to the overlay div
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "./search_item.php");
iframe.id = "search_window";
document.body.appendChild(iframe);
}
function searchDB(){
var text = document.getElementById("search").value;
iframe.setAttribute("src", './search_item.php?text=' + text);
}
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<link rel="stylesheet" href="./search.css" type="text/css" />
<script src="./iframe.js"></script>
<?php
include "../ConnectDB.php";
session_start();
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
if ($usertype == 'seller') {
$m = "seller_price";
} else {
$m = "buyer_price";
}
if(isset($_GET["text"])) {
$name = $_GET["text"];
if($name == null){
return;
}
$sql_find = "SELECT DISTINCT * FROM inventory WHERE name LIKE '%{$name}%' GROUP BY id";
$res = mysqli_query($conn, $sql_find);
$row = mysqli_num_rows($res);
$goods = mysqli_fetch_assoc($res);
if(!$goods){
echo '<h1 style="text-align: center;">item not found</h1>';
return;
}
echo '<div id="grid">';
for ($i = 0; $i < $row; $i++) {
echo '<table id="items">';
echo '<tr>';
echo '<td width="25%">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($goods['img']) . '" id="' . $goods['name'] . '" onclick="details(this)">';
echo '</td>';
echo '<td width="50%">';
echo '<h4 style="margin: 0%;" id="' . $goods['name'] . '" onclick="details(this)">' . $goods['name'] . '</h4>';
echo '</td>';
echo '<td width="25%">';
echo '<p style="margin: 0%;" >¥' . $goods[$m] . '/kg</p>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
echo '</div>';
}
else{
return;
}
?>

38
login/RegisterByDB.php Normal file
View File

@ -0,0 +1,38 @@
<?php
include "../indexes/ConnectDB.php";
//get posted messages
$user = $_POST["user"]; // username from login form
$pwd = $_POST["pwd"]; // password from login form
$user_type = $_POST["user_type"]; // password from login form
// check if user is empty
$sql_regname = "SELECT * FROM $user_type WHERE name = '$user'";
$res = mysqli_query($conn, $sql_regname);
$row = mysqli_num_rows($res);
if($row == 0){
if($user){
// prepare sql
$sql_insert = "INSERT INTO `$user_type` (`name`, `pwd`) VALUES ('$user', '$pwd')";
$result = mysqli_query($conn, $sql_insert); //if success, return 1
// redirect to interfaces
if($result > 0){
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_success.php';
</script>";
}
else {
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_interrupted.php';
</script>";
}
}
}
else{
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_failed.php';
</script>";
}
?>

18
login/index_login.php Normal file
View File

@ -0,0 +1,18 @@
<?php
include "../indexes/ConnectDB.php";
// Start the session
session_start();
// Check if the user is already logged in
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
echo "<script type='text/javascript'>
window.top.location.href = '../home.php';
</script>";
}
else {
echo "<script type='text/javascript'>
window.location.href = './login.html';
</script>";
}
?>

View 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;
}

View File

@ -0,0 +1,16 @@
<html>
<head>
<title>Admin</title>
<link rel="stylesheet" href="./profile.css" type="text/css" />
</head>
<body>
<div id="area">
<img src="../../icon/admin.svg">
<h2 style="margin: none;"><?php session_start(); echo $_SESSION['username']; ?></h2>
<p>User Type: Administrator</p>
<a href="../logout.php" style="text-decoration: none; color: white; background-color: rgba(69, 67, 67, 0.6);
border-radius: 5px; align-items: center; left: 50%;">Log out</a>
</div>
</body>
</html>

View File

@ -0,0 +1,30 @@
<html>
<head>
<title>User</title>
<link rel="stylesheet" href="./profile.css" type="text/css" />
</head>
<body>
<div id="area">
<img src="../../icon/buyer.svg">
<h2 style="margin: none;">
<?php
include '../../indexes/ConnectDB.php';
session_start();
echo $_SESSION['username'];
?>
</h2>
<p>User Type: Buyer</p>
<?php
$sql = "SELECT money FROM buyer WHERE name='" . $_SESSION['username'] . "'";
$res = mysqli_query($conn, $sql);
$money = mysqli_fetch_array($res);
?>
<p>Balance: <?php echo $money['money']; ?></p>
<a href="../../indexes/process/receipt.php" style="text-decoration: none; color: white; background-color: rgba(69, 67, 67, 0.6);
border-top-left-radius: 5px; border-bottom-left-radius: 5px;">My Receipt</a>
<a href="../logout.php" style="text-decoration: none; color: white; background-color: rgba(69, 67, 67, 0.6);
border-top-right-radius: 5px; border-bottom-right-radius: 5px;">Log out</a>
</div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<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>
<h2>Your Username or Password is incorrect!</h2>
<a href='../../login.html' style="text-decoration: none;">Try again</a>
<script type='text/javascript'>
setTimeout(function() {window.location.href = '../login.html';}, 1500);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<html>
<head>
<title>Seller</title>
<link rel="stylesheet" href="./profile.css" type="text/css" />
</head>
<body>
<div id="area">
<img src="../../icon/seller.svg">
<h2 style="margin: none;">
<?php
include '../../indexes/ConnectDB.php';
session_start();
echo $_SESSION['username'];
?>
</h2>
<p>User Type: Seller</p>
<?php
$sql = "SELECT profit FROM seller WHERE name='" . $_SESSION['username'] . "'";
$res = mysqli_query($conn, $sql);
$money = mysqli_fetch_array($res);
?>
<p>Profit: <?php echo $money['profit']; ?></p>
<a href="../../indexes/process/receipt.php" style="text-decoration: none; color: white; background-color: rgba(69, 67, 67, 0.6);
border-top-left-radius: 5px; border-bottom-left-radius: 5px;">My Receipt</a>
<a href="../logout.php" style="text-decoration: none; color: white; background-color: rgba(69, 67, 67, 0.6);
border-top-right-radius: 5px; border-bottom-right-radius: 5px;">Log out</a>
</div>
</body>
</html>

View 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>Welcome, <?php include '../../indexes/ConnectDB.php'; session_start(); echo $_SESSION['username']; ?>!</h1>
<script type='text/javascript'>
setTimeout(function() {window.top.location.href = '../../home.php';}, 1000);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,34 @@
#area{
position: absolute;
text-align: center;
width: 200px;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
user-select: none;
font-family: Arial, Helvetica, sans-serif;
}
img{
width: 100%;
height: 100px;
margin: none;
margin-top: 10%;
}
a{
display:table-cell;
vertical-align: middle;
border: 1px solid rgba(35, 34, 34, 0.6);
width: 200px;
height: 32px;
line-height: 30px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
box-shadow: 0px 0px 0px rgba(69, 67, 67, 0.6);
transition: 0.3s;
cursor: hand;
}
a:hover {
box-shadow: 0px 0px 10px #424242;
}

View File

@ -0,0 +1,18 @@
<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>
<h2>your username seems has already been registered.</h2>
<a href='../../login.html' style="text-decoration: none;">Try again</a>
<script type='text/javascript'>
setTimeout(function() {window.location.href = '../register.html';}, 1500);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<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>
<h2>Errors occurred during registeration, please try agian later.</h2>
<a href='../../login.html' style="text-decoration: none;">Try again</a>
<script type='text/javascript'>
setTimeout(function() {window.location.href = '../register.html';}, 1500);
</script>
</div>
</body>
</html>

View 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>Successfully registered!</h1>
<script type='text/javascript'>
setTimeout(function() {window.location.href = '../login.html';}, 1000);
</script>
</div>
</body>
</html>

66
login/login.css Normal file
View File

@ -0,0 +1,66 @@
#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;
}
input{
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: 32px;
width: 300px;
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;
}
label {
display:table-cell;
vertical-align: middle;
border: 1px solid rgba(35, 34, 34, 0.6);
width: 300px;
height: 32px;
line-height: 30px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
box-shadow: 0px 0px 0px rgba(69, 67, 67, 0.6);
transition: 0.3s;
cursor: hand;
}
label:hover {
box-shadow: 0px 0px 10px #424242;
}
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;
}
button:hover {
box-shadow: 0px 0px 10px #424242;
}
p{
font-family: Arial, Helvetica, sans-serif;
}

59
login/login.html Normal file
View File

@ -0,0 +1,59 @@
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="./login.css" type="text/css" />
</head>
<body>
<div id="area" style="text-align: center;">
<h1>Login</h1>
<!--input area-->
<form action = "./login.php" method="POST">
<input type="text" name="user" placeholder="Username" required>
<br><br>
<input type="password" name="pwd" placeholder="Password" required>
<br><br>
<label for="buyer" id="lb_buyer" onmousedown="implement(this)"
style="border-top-left-radius: 5px; border-bottom-left-radius: 5px;">Buyer</label>
<input type="radio" value="buyer" name="user_type" id="buyer" hidden required/>
<label for="seller" id="lb_seller" onmousedown="implement(this)">Seller</label>
<input type="radio" value="seller" name="user_type" id="seller" hidden required/>
<label for="admin" id="lb_admin" onmousedown="implement(this)"
style="border-top-right-radius: 5px; border-bottom-right-radius: 5px;">Administrator</label>
<input type="radio" value="admin" name="user_type" id="admin" oninvalid="radio_alert()" hidden required/>
<p id="msg" style="color: red; font-size: small; padding: none; margin: none;"></p>
<button type="submit">Log in</button>
</form>
<p style="font-size: small;">Don't have an account? <a href="register.html" style="text-decoration: none;">Sign up</a></p>
</div>
<script>
//beautify label
function implement(tag){
document.getElementById("msg").innerHTML = "";
if(tag.id == "lb_buyer"){
document.getElementById("lb_seller").style = "reset";
document.getElementById("lb_admin").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px;";
tag.style="border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
}
if(tag.id == "lb_seller"){
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px;";
document.getElementById("lb_admin").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px;";
tag.style="background-color: rgba(69, 67, 67, 0.6); color: white;";
}
if(tag.id == "lb_admin"){
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px;";
document.getElementById("lb_seller").style = "reset";
tag.style="border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
}
}
//alert if user choose nothing
function radio_alert(){
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: pink;";
document.getElementById("lb_seller").style = "background-color: pink;";
document.getElementById("lb_admin").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: pink;";
document.getElementById("msg").innerHTML = "Please choose a user type!";
}
</script>
</body>
</html>

63
login/login.php Normal file
View File

@ -0,0 +1,63 @@
<?php
include "../indexes/ConnectDB.php";
// Start the session
session_start();
//get posted messages
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user = $_POST["user"];
$pwd = $_POST["pwd"];
$user_type = $_POST["user_type"];
//select from db
$sql = "SELECT * FROM $user_type WHERE name = '$user' AND pwd = '$pwd' ";
// get the result from the query
$result = mysqli_query($conn, $sql);
// if the query returns some record, that means username and password are in the DB.
if(mysqli_num_rows($result)>0){
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $user;
$_SESSION['user_type'] = $user_type;
//redirect to interface
echo "<script type='text/javascript'>
window.location.href = './interfaces/login_success.php';
</script>";
}
else{
echo "<script type='text/javascript'>
window.location.href = './interfaces/login_failed.php';
</script>";
}
}
// Check if the user is already logged in
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
//check usertype and redirct to user page
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'buyer'){
echo "<script type='text/javascript'>
window.location.href = './interfaces/login_buyer.php';
</script>";
}
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'seller'){
echo "<script type='text/javascript'>
window.location.href = './interfaces/login_seller.php';
</script>";
}
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] === 'admin'){
echo "<script type='text/javascript'>
window.location.href = './interfaces/login_admin.php';
</script>";
}
}
else {
echo "<script type='text/javascript'>
window.top.location.href = './login.html';
</script>";
}
?>

19
login/logout.php Normal file
View File

@ -0,0 +1,19 @@
<?php
// Start the session
session_start();
// Unset all of the session variables
$_SESSION = array();
// Destroy the session
session_destroy();
// Redirect the user to the login page
echo "<script type='text/javascript'>
window.top.location.href = '../index.html';
</script>";
exit;
?>

49
login/register.html Normal file
View File

@ -0,0 +1,49 @@
<html>
<head>
<title>Register</title>
<link rel="stylesheet" href="./login.css" type="text/css" />
</head>
<body>
<div id="area" style="text-align: center;">
<h1>Register</h1>
<!--input area-->
<form action = "./RegisterByDB.php" method="POST">
<input type="text" name="user" placeholder="Username" required>
<br><br>
<input type="password" name="pwd" placeholder="Password" required>
<br><br>
<label for="buyer" id="lb_buyer" onmousedown="implement(this)"
style="border-top-left-radius: 5px; border-bottom-left-radius: 5px;">Buyer</label>
<input type="radio" value="buyer" name="user_type" id="buyer" hidden required/>
<label for="seller" id="lb_seller" onmousedown="implement(this)"
style="border-top-right-radius: 5px; border-bottom-right-radius: 5px;">Seller</label>
<input type="radio" value="seller" name="user_type" id="seller" oninvalid="radio_alert()" hidden required/>
<p id="msg" style="color: red; font-size: small; padding: none; margin: none;"></p>
<button type="submit">Sign up</button>
</form>
<p style="font-size: small;">Already have an account? <a href="login.html" style="text-decoration: none;">Sign in</a></p>
</div>
<script>
//beautify label
function implement(tag){
document.getElementById("msg").innerHTML = "";
if(tag.id == "lb_buyer"){
document.getElementById("lb_seller").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px;";
tag.style="border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
}
if(tag.id == "lb_seller"){
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px;";
tag.style="border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
}
}
//alert if user choose nothing
function radio_alert(){
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: pink;";
document.getElementById("lb_seller").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: pink;";
document.getElementById("msg").innerHTML = "Please choose a user type!";
}
</script>
</body>
</html>

199
proj_db.sql Normal file

File diff suppressed because one or more lines are too long