File manager - Edit - /home/familylifersmpc/htdocs/www.familylifersmpc.com/client_view.php
Back
<?php error_reporting(0); include('editor-includes/web-config.php'); $conn = new mysqli($host, $user, $pass, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Pagination settings $postsPerPage = 6; $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $postsPerPage; // Count total posts for pagination $totalResult = $conn->query("SELECT COUNT(*) AS total FROM POSTINGTBL"); $totalPosts = $totalResult->fetch_assoc()['total']; $totalPages = ceil($totalPosts / $postsPerPage); // Fetch posts with limit $result = $conn->query("SELECT * FROM POSTINGTBL ORDER BY ID DESC LIMIT $start, $postsPerPage"); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Gallery Posts</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/css/lightbox.min.css" rel="stylesheet"> <style> body { background: #f0f2f5; font-family: Arial, sans-serif; } .post-grid { display: grid; grid-template-columns: 1fr; gap: 20px; } @media (min-width: 992px) { .post-grid { grid-template-columns: 1fr 1fr 1fr; /* 3 posts per row */ } } .post-card { background: #fff; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid #ddd; /* Subtle border instead of shadow */ transition: transform 0.2s ease, box-shadow 0.2s ease; } .post-card:hover { transform: translateY(-3px); box-shadow: 0 3px 10px rgba(0,0,0,0.1); /* Light hover shadow */ } .gallery-wrapper { display: grid; gap: 2px; } .gallery-1 { grid-template-columns: 1fr; } .gallery-2 { grid-template-columns: 1fr 1fr; } .gallery-3 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; } .gallery-4 { grid-template-columns: 1fr 1fr; } .gallery-5 { grid-template-columns: 1fr 1fr 1fr; } .gallery-6 { grid-template-columns: 1fr 1fr 1fr; } .gallery-wrapper img { width: 100%; height: 180px; /* Adjusted for 3 columns */ object-fit: cover; cursor: pointer; transition: transform 0.2s ease; } .gallery-wrapper img:hover { transform: scale(1.02); } .more-overlay { position: relative; } .more-overlay span { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; font-weight: bold; } .content { padding: 15px; } .content h4 { margin: 5px 0; font-size: 18px; font-weight: bold; } .content p { color: #333; margin-bottom: 0; } .post-meta { font-size: 13px; color: #888; margin-bottom: 5px; } /* Pagination */ .pagination { display: flex; justify-content: center; margin: 20px 0; gap: 5px; } .pagination a { color: #333; padding: 8px 12px; border: 1px solid #ddd; border-radius: 5px; text-decoration: none; transition: background 0.2s ease, color 0.2s ease; } .pagination a:hover { background: #007bff; color: #fff; } .pagination .active { background: #007bff; color: #fff; pointer-events: none; } </style> </head> <body> <div class="container" style="max-width: 1600px; margin-top: 20px; width: 100%;"> <h3 class="text-center mb-4">Gallery Posts</h3> <div class="post-grid"> <?php while ($row = $result->fetch_assoc()): ?> <div class="post-card"> <?php $folder = "UPLOADS/" . $row['FolderName']; if (is_dir($folder)) { $files = array_values(array_diff(scandir($folder), ['.', '..'])); $totalImages = count($files); if ($totalImages > 0) { $displayCount = min(6, $totalImages); $galleryClass = "gallery-" . $displayCount; echo '<div class="gallery-wrapper ' . $galleryClass . '">'; foreach ($files as $index => $file) { $filePath = $folder . "/" . $file; if ($index < 5 || ($index == 5 && $totalImages <= 6)) { echo "<a href='$filePath' data-lightbox='post{$row['ID']}' data-title='".htmlspecialchars($row['Title'])."'> <img src='$filePath' alt='Post Image'> </a>"; } elseif ($index == 5 && $totalImages > 6) { $moreCount = $totalImages - 6; echo "<a href='$filePath' data-lightbox='post{$row['ID']}' data-title='".htmlspecialchars($row['Title'])."'> <div class='more-overlay'> <img src='$filePath' alt='Post Image'> <span>+{$moreCount}</span> </div> </a>"; } else { echo "<a href='$filePath' data-lightbox='post{$row['ID']}' data-title='".htmlspecialchars($row['Title'])."' style='display:none;'></a>"; } } echo '</div>'; } } ?> <div class="content"> <div class="post-meta"> Posted on <?php echo date("F j, Y"); ?> </div> <h4><?php echo htmlspecialchars($row['Title']); ?></h4> <p><?php echo nl2br(htmlspecialchars($row['Description'])); ?></p> </div> </div> <?php endwhile; ?> </div> <!-- Pagination Links --> <div class="pagination"> <?php for ($i = 1; $i <= $totalPages; $i++): ?> <a href="?page=<?php echo $i; ?>" class="<?php echo ($i == $page) ? 'active' : ''; ?>"> <?php echo $i; ?> </a> <?php endfor; ?> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/js/lightbox-plus-jquery.min.js"></script> </body> </html> <?php $conn->close(); ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings