|
Server IP : 2a02:4780:11:767:0:2c41:85d9:6 / Your IP : 216.73.217.91 Web Server : LiteSpeed System : Linux in-mum-web667.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64 User : u742491609 ( 742491609) PHP Version : 8.1.34 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u742491609/domains/apca.org.in/public_html/admin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
$email = $_SESSION["email"];
if (!isset($_SESSION["email"])) {
header("location: index.php");
exit;
}
include("../connection.php");
include 'header.php';
include 'sidebar.php';
?>
<div class="page-wrapper">
<div class="content container-fluid">
<div class="page-header">
<div class="row">
<div class="col">
<h3 class="page-title">Blog Table</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Dashboard</a></li> /
<li class="breadcrumb-item active">Blog Table</li>
</ul>
</div>
<div class="col-auto text-end float-end ms-auto">
<a href="add-blog.php" class="btn btn-outline-primary me-2"><i class="fas fa-plus"></i> Add</a>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="datatable table table-stripped">
<thead>
<tr>
<th>Event Name</th>
<th>Images</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$sql = $conn->prepare("SELECT * FROM `blog` ORDER BY `id` DESC");
$sql->execute();
if ($sql->rowCount() > 0) {
$rows = $sql->fetchAll();
$eventGroups = [];
// Group images by event names
foreach ($rows as $row) {
$eventGroups[$row['blog_name']][] = $row;
}
// Display each event and its images
foreach ($eventGroups as $eventName => $eventImages) {
$imageCount = 0;
foreach ($eventImages as $image) {
if ($imageCount % 5 == 0) {
if ($imageCount > 0) {
echo "</td></tr>";
}
echo "<tr>";
echo "<td>{$eventName}</td>";
echo "<td>";
}
echo "<img height='60' width='90' class='img-responsive' alt='" . htmlspecialchars($image['blog_name']) . "' src='../uploads/" . htmlspecialchars($image['img']) . "' style='margin-right: 10px;'/>";
$imageCount++;
// Close the row and display description and actions
if ($imageCount % 5 == 0 || $imageCount == count($eventImages)) {
echo "</td><td>";
// Display the description
$description = strip_tags($image['description']);
if (strlen($description) > 85) {
$description = substr($description, 0, 85) . '...';
}
echo htmlspecialchars($description);
echo "</td><td>";
// Actions
echo "<a href='edit-blog.php?id=" . $image['id'] . "' class='btn btn-sm bg-success-light me-2'>
<i class='fas fa-pen'></i>
</a>";
echo "<a href='delete-blog.php?id=" . $image['id'] . "' onClick='return confirm(\"Do you want to delete this blog " . htmlspecialchars($image['blog_name']) . "?\");' class='btn btn-sm bg-danger-light'>
<i class='fas fa-trash'></i>
</a>";
echo "</td></tr>";
}
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>