File "slider.php"
Full path: /home/fsibplc/public_html/sommilito-bank/admin/slider.php
File
size: 6.05 B (6.05 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
include 'admin-header.php';
// $result = $conn->query("SELECT * FROM sliders ORDER BY id DESC limit 10");
$result = $conn->query("
SELECT sliders.*, users.username AS author_name, users.division
FROM sliders
INNER JOIN users ON sliders.author = users.id
ORDER BY sliders.id DESC
LIMIT 10
");
?>
<!-- Content -->
<main class="flex-1 p-6 overflow-auto">
<!-- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> -->
<h3 class="text-xl font-semibold text-teal-900 mb-3">Slider Management</h3>
<div class="p-6">
<div class="bg-white shadow-sm rounded-xl border border-gray-200 overflow-hidden">
<!-- Table Header -->
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-200 bg-gray-100">
<h2 class="text-sm font-semibold text-gray-700">Sliders List</h2>
<a href="slider-add.php" class="flex items-center gap-2 bg-gray-50 text-sm font-semibold text-teal-800 px-4 py-2 float-right">
<svg class="w-5 h-5 text-teal-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 7.757v8.486M7.757 12h8.486M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
</svg>
Add Slider
</a>
</div>
<!-- Table -->
<table class="w-full text-sm text-left">
<!-- Head -->
<thead class="bg-gray-50 text-gray-600 uppercase text-xs">
<tr>
<th class="px-6 py-3">ID</th>
<th class="px-6 py-3">Title</th>
<th class="px-6 py-3">Image</th>
<th class="px-6 py-3">Author</th>
<th class="px-6 py-3 text-center">Action</th>
</tr>
</thead>
<!-- Body -->
<tbody class="divide-y divide-gray-100">
<?php while ($row = $result->fetch_assoc()): ?>
<tr class="hover:bg-gray-50 transition">
<!-- ID -->
<td class="px-6 py-4 font-medium text-gray-700">
#<?= $row['id'] ?>
</td>
<!-- Title -->
<td class="px-6 py-4 text-gray-800">
<?= htmlspecialchars($row['title']) ?>
</td>
<!-- Image -->
<td class="px-6 py-4">
<div class="flex items-center">
<img
src="uploads/sliders/<?= $row['image'] ?>"
class="h-12 w-20 object-cover rounded-md border border-gray-300 shadow-sm">
</div>
</td>
<td class="px-6 py-4 text-gray-500">
<?= htmlspecialchars($row['author_name']) ?> <br> <?= htmlspecialchars($row['division']) ?>
</td>
<!-- Actions -->
<td class="px-6 py-4">
<div class="flex justify-center gap-2">
<!-- Edit -->
<a href="slider-edit.php?id=<?= $row['id'] ?>"
class="p-2 rounded-lg bg-teal-50 hover:bg-teal-100 text-teal-700 transition"
title="Edit">
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
d="m14.304 4.844 2.852 2.852M7 7H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4.5m2.409-9.91a2.017 2.017 0 0 1 0 2.853l-6.844 6.844L8 14l.713-3.565 6.844-6.844a2.015 2.015 0 0 1 2.852 0Z" />
</svg>
</a>
<!-- Delete -->
<a href="slider-delete.php?id=<?= $row['id'] ?>"
onclick="return confirm('Are you sure you want to delete this slider?')"
class="p-2 rounded-lg bg-red-50 hover:bg-red-100 text-red-600 transition"
title="Delete">
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z" />
</svg>
</a>
</div>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
<!-- Add more cards/content here -->
<!-- </div> -->
</main>
</div>
</body>
</html>