BLACKSITE
:
216.73.216.62
:
147.93.18.13 / vinyasaweddings.com
:
Linux srv667811 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
:
/
var
/
www
/
insonohearing
/
admin
/
Upload File:
files >> /var/www/insonohearing/admin/all_product.php
<?php require __DIR__ . '/../db.php'; // Adjust path if needed // Fetch all products with their details $stmt = $conn->query(" SELECT p.id AS product_id, p.name AS product_name, p.images, d.detail_key, d.detail_value FROM products p LEFT JOIN product_details d ON p.id = d.product_id ORDER BY p.id DESC "); $products = []; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $id = $row['product_id']; if (!isset($products[$id])) { $products[$id] = [ 'name' => $row['product_name'], 'images' => json_decode($row['images'], true), 'details' => [], ]; } if ($row['detail_key']) { $products[$id]['details'][] = [ 'key' => $row['detail_key'], 'value' => $row['detail_value'], ]; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>All Products</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="icon" href="https://insonohearing.com/assets_b/img/favicon-32x32.png" type="image/png" sizes="32x32"> <link rel="icon" href="https://insonohearing.com/assets_b/img/favicon-32x32.png" type="image/png" sizes="16x16"> <style> .table img { height: 60px; object-fit: cover; border-radius: 6px; } .details-box { max-height: 120px; overflow-y: auto; } .add-btn { float: right; } </style> </head> <body> <div class="container mt-5"> <a href="index.php?page=dashboard" class="btn btn-primary btn-back">← Back to Dashboard</a> <div class="d-flex justify-content-between align-items-center mb-3"> <h2>All Products</h2> <a href="index.php?page=add_product" class="btn btn-success add-btn">+ Add Product</a> </div> <div class="table-responsive"> <table class="table table-bordered table-striped table-hover"> <thead class="thead-dark"> <tr> <th scope="col">Image</th> <th scope="col">Product Name</th> <th scope="col">Details</th> <th scope="col" style="width: 100px;">Action</th> </tr> </thead> <tbody> <?php foreach ($products as $productId => $product): ?> <tr> <!-- Image --> <td> <?php $firstImage = $product['images'][0] ?? 'https://via.placeholder.com/100'; ?> <img src="<?= $firstImage ?>" alt="Product Image"> </td> <!-- Name --> <td><?= htmlspecialchars($product['name']) ?></td> <!-- Details --> <td> <div class="details-box"> <ul class="list-unstyled mb-0"> <?php foreach ($product['details'] as $detail): ?> <li><strong><?= htmlspecialchars($detail['key']) ?>:</strong> <?= htmlspecialchars($detail['value']) ?></li> <?php endforeach; ?> </ul> </div> </td> <!-- Action --> <td> <a href="?page=edit_product&id=<?= $productId ?>" class="btn btn-sm btn-primary btn-block">Edit</a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </body> </html>