D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
Filename :
ashaar_summary.php
back
Copy
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Image Categories</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css"> </head> <body> <div class="container mt-4"> <a href='ashaar_filter.php'>Filter</a> <h1 class="text-center mb-4">Image Categories</h1> <!-- Add a button to show all categories --> <div class="text-center"> <button class="btn btn-primary" id="showAllButton">HOME</button> </div> <!-- Display Categories and Number of Records --> <?php include 'config.php'; // Query to retrieve categories and record counts from your database $categorySql = "SELECT category, COUNT(*) AS record_count FROM pictures GROUP BY category"; $categoryResult = $conn->query($categorySql); echo '<div class="list-group">'; while ($categoryRow = $categoryResult->fetch_assoc()) { $category = $categoryRow['category']; $recordCount = $categoryRow['record_count']; // Display categories as clickable links echo '<a href="?category=' . $category . '" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">'; echo $category; echo '<span class="badge bg-primary rounded-pill">' . $recordCount . '</span>'; echo '</a>'; } echo '</div>'; ?> <!-- Display Images for the Selected Category --> <div class="row row-cols-1 row-cols-md-2 row-cols-lg-6 mt-2"> <?php if (isset($_GET['category'])) { $selectedCategory = $_GET['category']; // Query to retrieve images for the selected category $sql = "SELECT picture_path, date_of_picture, category FROM pictures WHERE category = '$selectedCategory' ORDER BY date_of_picture DESC"; } else { // Query to retrieve images for all categories $sql = "SELECT picture_path, date_of_picture, category FROM pictures ORDER BY id DESC"; } $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo '<div class="col mb-2">'; echo '<div class="image-item">'; $folderName = 'admin'; // Set your folder name here $imagePath = $folderName . '/' . $row['picture_path']; // Concatenate folder name and path echo '<img src="' . $imagePath . '" class="img-fluid" alt="Image">'; echo '<div class="date-info">'; echo '<span class="date-label">Date of Picture:</span>'; echo '<span>' . $row['date_of_picture'] . '</span>'; echo '</div>'; echo '</div>'; echo '</div>'; } } else { echo "No images found."; } ?> </div> </div> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script> <script> // Show all categories when the "Show All Categories" button is clicked $("#showAllButton").click(function () { window.location.href = "index.php"; }); </script> </body> </html>