2021-12-14 17:19:28 +01:00
|
|
|
<?php
|
|
|
|
include_once('header.php');
|
|
|
|
include_once('parameters.php');
|
|
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['username'])) {
|
|
|
|
header("Location: ./home.php");
|
|
|
|
}
|
2022-01-11 18:44:49 +01:00
|
|
|
$userId = $_SESSION['userid'];
|
|
|
|
$userName = $_SESSION['username'];
|
|
|
|
$userAddDate = $_SESSION['useradddate'];
|
2021-12-14 17:19:28 +01:00
|
|
|
|
|
|
|
//FILTER BUTTON
|
|
|
|
|
|
|
|
// if (isset($_POST['submit'])) {
|
|
|
|
// $uid = $_POST['uid'];
|
|
|
|
// $date = $_POST['date'];
|
|
|
|
|
|
|
|
// $query = "SELECT * FROM uren WHERE DATUM(post_date)='$date'";
|
|
|
|
// $respost = mysqli_query($mysqli, $query);
|
|
|
|
// } else {
|
|
|
|
// $query = "SELECT * FROM uren";
|
|
|
|
// $respost = mysqli_query($mysqli, $query);
|
|
|
|
// }
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="w3-content w3-padding w3-margin-top" style="max-width:1564px;margin-top:32px">
|
|
|
|
<!-- Header -->
|
2022-01-11 18:44:49 +01:00
|
|
|
<div class="w3-display-container w3-content w3-wide" style="max-width:1500px;" id="home">
|
|
|
|
<img class="w3-image" src="img/banner.jpg" alt="Botiga_php" width="1500" height="250">
|
2021-12-14 17:19:28 +01:00
|
|
|
<div class="w3-display-middle w3-margin-top w3-center">
|
2022-01-11 18:44:49 +01:00
|
|
|
<h1 class="w3-xxlarge w3-text-white"><span class="w3-padding w3-black w3-opacity-min"><b>Botiga</b></span> <span style="font-weight:bold" class="w3-hide-small w3-text-light-gray">php</span></h1>
|
2021-12-14 17:19:28 +01:00
|
|
|
</div>
|
2022-01-11 18:44:49 +01:00
|
|
|
</div>
|
2021-12-14 17:19:28 +01:00
|
|
|
|
2022-01-11 18:44:49 +01:00
|
|
|
<div class="w3-container w3-row w3-border-bottom w3-border-light-grey w3-padding-32" id="projects">
|
|
|
|
<div class="w3-container w3-col m3">
|
|
|
|
<h3>My Products 🗊</h3>
|
|
|
|
</div>
|
|
|
|
<div class="w3-container w3-col m3">
|
|
|
|
<h4>User: <?php echo $userName . " "?></h4>
|
|
|
|
</div>
|
|
|
|
<div class="w3-container w3-col m3">
|
|
|
|
<h4>Account Creation: <?php echo $userAddDate . " "?></h4>
|
|
|
|
</div>
|
|
|
|
<div style="max-height:45px;max-width:270px;display:flex;justify-content:center;align-items: center;" onclick="document.getElementById('id01').style.display='block'" class="w3-button w3-black w3-col m3">
|
|
|
|
<h4>Upload New Product ✚</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Product uploader modal -->
|
|
|
|
<div id="id01" class="w3-modal">
|
|
|
|
<div class="w3-modal-content w3-animate-zoom">
|
|
|
|
<header class="w3-container w3-black">
|
|
|
|
<span onclick="document.getElementById('id01').style.display='none'"
|
|
|
|
class="w3-button w3-display-topright">×</span>
|
|
|
|
<h2>Upload New Product</h2>
|
|
|
|
</header>
|
|
|
|
<div class="w3-container">
|
|
|
|
<form action="./insert-product.php">
|
|
|
|
<div class="w3-container"><input class="w3-input w3-border" type="text" name="prodTitle" id="prodTitle" placeholder="Porduct Title.."></div><br>
|
|
|
|
<div class="w3-container"><textarea class="w3-input w3-border" name="prodDescription" id="prodDescription" cols="30" rows="5" placeholder="Product Description.."></textarea></div><br>
|
|
|
|
<div class="w3-container"><input class="w3-input w3-border" type="text" name="prodPrice" id="prodPrice" placeholder="Porduct Prce in Euros.."></div><br><br>
|
|
|
|
<div class="w3-container"><input class="w3-button w3-black w3-display-bottommiddle" type="submit" value="Upload ⤒" onclick="document.getElementById('id01').style.display='none'"></div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="w3-container"><input type="submit" value="Upload ⤒" onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-black w3-display-bottommiddle"></div>
|
|
|
|
</div>
|
2021-12-14 17:19:28 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
2022-01-09 14:33:01 +01:00
|
|
|
echo('<form name="filter" method="POST" action="my-products.php">');
|
2021-12-14 17:19:28 +01:00
|
|
|
include_once('form.php');
|
2022-01-09 14:33:01 +01:00
|
|
|
echo('</form>');
|
2021-12-14 17:19:28 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="w3-bar w3-margin"></div>
|
|
|
|
<div class="w3-bar w3-margin"></div>
|
|
|
|
|
|
|
|
<div class="w3-row-padding">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($_POST)) {
|
2022-01-09 14:33:01 +01:00
|
|
|
$productName = $_POST['search'];
|
|
|
|
$productInfo = $_POST['search'];
|
|
|
|
$productCategory = $_POST['category'];
|
|
|
|
$minProductPrice = $_POST['minPrice'];
|
|
|
|
$maxProductPrice = $_POST['maxPrice'];
|
|
|
|
|
|
|
|
$sqlString = "SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products WHERE bp_product_owner = $userid";
|
|
|
|
if (!empty($_POST['search'])) $sqlString .= " AND (bp_product_name LIKE '%$productName%' OR bp_product_info LIKE '%$productInfo%')";
|
|
|
|
if ($productCategory != "empty") $sqlString .= " AND bp_product_category = $productCategory";
|
|
|
|
if ($minProductPrice != "empty") $sqlString .= " AND bp_product_price >= $minProductPrice";
|
|
|
|
if ($maxProductPrice != "empty") $sqlString .= " AND bp_product_price <= $maxProductPrice";
|
2021-12-14 17:19:28 +01:00
|
|
|
|
2022-01-09 14:33:01 +01:00
|
|
|
$sql = $con->prepare($sqlString);
|
2021-12-14 17:19:28 +01:00
|
|
|
} else {
|
2022-01-11 18:44:49 +01:00
|
|
|
$sqlString = "SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products WHERE bp_product_owner = $userId";
|
2021-12-14 17:19:28 +01:00
|
|
|
|
2022-01-09 14:33:01 +01:00
|
|
|
$sql = $con->prepare($sqlString);
|
2021-12-14 17:19:28 +01:00
|
|
|
}
|
|
|
|
$sql->execute();
|
|
|
|
|
|
|
|
$sql->bind_result($bp_product_id, $bp_product_name, $bp_product_price, $bp_product_img_01);
|
|
|
|
while ($sql->fetch()) {
|
|
|
|
|
|
|
|
echo ("
|
|
|
|
<div class=\"w3-col l3 m6 w3-margin-bottom\">
|
|
|
|
<a href=\"./productDetail.php?bp_product_id=$bp_product_id\">
|
|
|
|
<div class=\"w3-display-container\">
|
|
|
|
<div class=\"w3-display-topleft w3-black w3-padding\">$bp_product_name</div>
|
2022-01-11 18:44:49 +01:00
|
|
|
<div class=\"w3-display-bottomright w3-black w3-padding\">" . number_format($bp_product_price,2,",",".") . " €</div>
|
2021-12-14 17:19:28 +01:00
|
|
|
<img src=\"img/$bp_product_img_01\" alt=\"House\" style=\"width:100%\">
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
");
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
include('footer.php');
|
|
|
|
|
|
|
|
?>
|