D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
view_ashaar.php
back
Copy
<?php include "../config.php"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Image Gallery</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css"> <style> .thumbnail { max-width: 100%; height: auto; } </style> </head> <body> <div class="container mt-4"> <h1 class="text-center mb-4">Delete Image</h1> <center><a href="index.php"><button>Main menu</button></a></center> <div class="row"> <?php $itemsPerPage = 12; $sqlCount = "SELECT COUNT(*) AS total FROM pictures"; $countResult = $conn->query($sqlCount); $rowCount = $countResult->fetch_assoc()['total']; $totalPages = ceil($rowCount / $itemsPerPage); $currentPage = isset($_GET['page']) ? $_GET['page'] : 1; $startIndex = ($currentPage - 1) * $itemsPerPage; $sql = "SELECT id, picture_path, date_of_picture, category FROM pictures ORDER BY id DESC LIMIT $startIndex, $itemsPerPage"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo '<div class="col-md-2 mb-4">'; echo '<div class="card">'; echo '<img src="' . $row['picture_path'] . '" class="card-img-top thumbnail" alt="Image">'; echo '<div class="card-body">'; echo '<p class="card-text">' . $row['date_of_picture'] . '</p>'; echo '<a href="delete_image.php?id=' . $row['id'] . '" class="btn btn-danger">Delete</a>'; echo '</div>'; echo '</div>'; echo '</div>'; } } else { echo '<div class="col-12">'; echo '<p>No images found.</p>'; echo '</div>'; } $conn->close(); ?> </div> <nav aria-label="Page navigation"> <ul class="pagination justify-content-center"> <?php for ($i = 1; $i <= $totalPages; $i++) { $active = $i == $currentPage ? 'active' : ''; echo '<li class="page-item ' . $active . '"><a class="page-link" href="?page=' . $i . '">' . $i . '</a></li>'; } ?> </ul> </nav> </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> </body> </html>