D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
kk.encodersunlimited.com
/
Filename :
products.php
back
Copy
<?php session_start(); include 'config.php'; // Check if the admin is logged in if (!isset($_SESSION['admin_name'])) { echo '<script>window.location.href = "login.php";</script>'; exit; } // Fetch categories securely using prepared statements $categories = []; $categoryQuery = "SELECT * FROM `category`"; $categoryStmt = mysqli_prepare($conn, $categoryQuery); mysqli_stmt_execute($categoryStmt); $categoryResult = mysqli_stmt_get_result($categoryStmt); if ($categoryResult) { while ($row = mysqli_fetch_assoc($categoryResult)) { $categories[] = $row; } } // Fetch products with category, party, description, shape, and clarity names securely $productQuery = " SELECT p.*, c.category_name, pa.party_name FROM products p LEFT JOIN category c ON p.category = c.id LEFT JOIN party pa ON p.party = pa.id "; $productStmt = mysqli_prepare($conn, $productQuery); mysqli_stmt_execute($productStmt); $productResult = mysqli_stmt_get_result($productStmt); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>kk-admin</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="Premium Multipurpose Admin & Dashboard Template" name="description" /> <meta content="Themesbrand" name="author" /> <!-- App favicon --> <link rel="shortcut icon" href="assets/images/favicon.ico"> <!-- plugin css --> <link href="assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" /> <!-- preloader css --> <link rel="stylesheet" href="assets/css/preloader.min.css" type="text/css" /> <!-- Bootstrap Css --> <link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" /> <!-- Icons Css --> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <!-- App Css--> <link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" /> </head> <body> <!-- Begin page --> <div id="layout-wrapper"> <?php include('header.php')?> <!-- Left Sidebar Start --> <?php include('sidebar.php')?> <!-- Left Sidebar End --> <!-- Start right Content here --> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-sm-flex align-items-center justify-content-between"> <h4 class="mb-sm-0 font-size-18">Product List</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);">product</a></li> <li class="breadcrumb-item active">Product List</li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <div class="table-responsive"> <table class="table table-striped table-hover" id="project-status"> <thead> <tr> <th><span class="f-dark f-w-600">ID</span></th> <th><span class="f-dark f-w-600">Image</span></th> <th><span class="f-dark f-w-600">Summary No</span></th> <th><span class="f-dark f-w-600">Name</span></th> <th><span class="f-dark f-w-600">Party</span></th> <th><span class="f-dark f-w-600">Category</span></th> <th><span class="f-dark f-w-600">Description</span></th> <th><span class="f-dark f-w-600">Shape</span></th> <th><span class="f-dark f-w-600">Clarity</span></th> <th><span class="f-dark f-w-600">Action</span></th> </tr> </thead> <tbody> <?php $i = 1; while ($item = mysqli_fetch_assoc($productResult)) { $imageSrc = htmlspecialchars($item['image'], ENT_QUOTES, 'UTF-8'); $id = $item['id']; ?> <tr> <th scope="row"><?php echo $i; ?></th> <td><img src="uploads/<?php echo $imageSrc; ?>" alt="Product Image" width="100px"></td> <td><?php echo htmlspecialchars($item['summary_no'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['name'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['party_name'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['category_name'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['description'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['shape'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($item['clarity'], ENT_QUOTES, 'UTF-8'); ?></td> <td> <a href="edit_product.php?id=<?php echo $id; ?>" class="btn btn-success"><i class="bx bx-edit"></i> Edit</a> <form action="crud.php" method="POST" style="display:inline;"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <button type="submit" name="delete_product" class="btn btn-danger"><i class="bx bxs-trash"></i> Delete</button> </form> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> </div> </div> </div> <!-- end col --> </div> <!-- end row --> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <footer class="footer"> <div class="container-fluid"> <div class="row"> <div class="col-sm-6"> <script>document.write(new Date().getFullYear())</script> © KK Jewellers. </div> <div class="col-sm-6"> <div class="text-sm-end d-none d-sm-block"> Design & Develop by <a href="#!" class="text-decoration-underline">Encoders Unlimited</a> </div> </div> </div> </div> </footer> </div> <!-- end main content--> </div> <!-- END layout-wrapper --> <!-- Right Sidebar --> <div class="right-bar"> <div data-simplebar class="h-100"> <div class="rightbar-title d-flex align-items-center bg-dark p-3"> <h5 class="m-0 me-2 text-white">Theme Customizer</h5> <a href="javascript:void(0);" class="right-bar-toggle ms-auto"> <i class="mdi mdi-close noti-icon"></i> </a> </div> <!-- Settings --> <hr class="m-0" /> <div class="p-4"> <h6 class="mb-3">Layout</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout" id="layout-vertical" value="vertical"> <label class="form-check-label" for="layout-vertical">Vertical</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout" id="layout-horizontal" value="horizontal"> <label class="form-check-label" for="layout-horizontal">Horizontal</label> </div> <h6 class="mt-4 mb-3 pt-2">Layout Mode</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-mode" id="layout-mode-light" value="light"> <label class="form-check-label" for="layout-mode-light">Light</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-mode" id="layout-mode-dark" value="dark"> <label class="form-check-label" for="layout-mode-dark">Dark</label> </div> <h6 class="mt-4 mb-3 pt-2">Layout Width</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-width" id="layout-width-fluid" value="fluid"> <label class="form-check-label" for="layout-width-fluid">Fluid</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="layout-width" id="layout-width-boxed" value="boxed"> <label class="form-check-label" for="layout-width-boxed">Boxed</label> </div> <h6 class="mt-4 mb-3 pt-2">Sidebar Color</h6> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="sidebar-color" id="sidebar-color-light" value="light"> <label class="form-check-label" for="sidebar-color-light">Light</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="sidebar-color" id="sidebar-color-dark" value="dark"> <label class="form-check-label" for="sidebar-color-dark">Dark</label> </div> </div> </div> </div> <!-- /Right-bar --> <!-- Javascript --> <script src="assets/js/vendor.min.js"></script> <script src="assets/js/app.min.js"></script> <script src="assets/libs/jquery/jquery.min.js"></script> <script src="assets/libs/datatables/jquery.dataTables.min.js"></script> <script src="assets/libs/datatables/dataTables.bootstrap4.min.js"></script> </body> </html>