BLACKSITE
:
216.73.216.62
:
147.93.18.13 / vinyasaweddings.com
:
Linux srv667811 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
:
/
var
/
www
/
kds
/
views
/
admin
/
Upload File:
files >> /var/www/kds/views/admin/faq-manage.php
<?php include 'views/admin/layout/header.php'; ?> <?php include 'views/admin/layout/Sidebar.php'; ?> <?php require_once __DIR__ . '/../../db.php'; ?> <?php // Handle status update if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['faq_id'], $_POST['status'])) { $faqId = (int) $_POST['faq_id']; $newStatus = $_POST['status']; if (in_array($newStatus, ['active', 'inactive'])) { $stmt = $db->prepare("UPDATE faqs SET status = ? WHERE id = ?"); $stmt->execute([$newStatus, $faqId]); echo "<script>location.href = window.location.href;</script>"; exit; } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_id'])) { $faqId = (int) $_POST['delete_id']; $stmt = $db->prepare("DELETE FROM faqs WHERE id = ?"); $stmt->execute([$faqId]); echo "<script>location.href = window.location.href;</script>"; exit; } // Fetch all FAQs $stmt = $db->query("SELECT * FROM faqs ORDER BY id DESC"); $faqs = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> <main class="main-content"> <div class="container-fluid px-4"> <div class="d-flex justify-content-between align-items-center mb-4"> <h1 class="mb-0 fw-bold">Manage FAQs</h1> <a href="faq-add" class="btn btn-primary"> <i class="fas fa-plus me-2"></i>Add New FAQ </a> </div> <div class="card shadow-sm border-0"> <div class="card-body p-0"> <div class="table-responsive rounded-3"> <table class="table table-hover mb-0"> <thead class="bg-light"> <tr> <th class="py-3 px-4 text-nowrap" style="width: 80px;">ID</th> <th class="py-3 px-4">Question / Answer</th> <th class="py-3 px-4 text-center" style="width: 150px;">Status</th> <th class="py-3 px-4 text-center" style="width: 120px;">Actions</th> </tr> </thead> <tbody> <?php if (count($faqs) > 0): ?> <?php $i = 1; foreach ($faqs as $faq): ?> <tr class="align-middle"> <td class="px-4 fw-semibold text-muted"><?= $i ?></td> <td class="px-4"> <div class="d-flex flex-column"> <strong class="text-dark"><?= htmlspecialchars($faq['question']) ?></strong> <small class="text-muted mt-1"><?= nl2br(htmlspecialchars($faq['answer'])) ?></small> </div> </td> <td class="px-4 text-center"> <form method="POST" class="d-inline-block"> <input type="hidden" name="faq_id" value="<?= $faq['id'] ?>"> <select name="status" class="form-select form-select-sm w-auto d-inline-block" onchange="this.form.submit()" style="min-width: 100px;"> <option value="active" <?= $faq['status'] === 'active' ? 'selected' : '' ?> class="text-success">Active</option> <option value="inactive" <?= $faq['status'] === 'inactive' ? 'selected' : '' ?> class="text-danger">Inactive</option> </select> </form> </td> <td class="px-4 text-center"> <a href="faq-add?id=<?= $faq['id'] ?>" class="btn btn-sm btn-primary me-2" title="Edit FAQ"> <i class="fas fa-edit"></i> </a> <!-- <form method="POST" class="d-inline-block" onsubmit="return confirm('Are you sure you want to delete this FAQ?');"> <input type="hidden" name="delete_id" value="<?= $faq['id'] ?>"> <button type="submit" class="btn btn-sm btn-danger" title="Delete FAQ"> <i class="fas fa-trash"></i> </button> </form> --> </td> </tr> <?php $i++; endforeach; ?> <?php else: ?> <tr> <td colspan="4" class="text-center py-4 text-muted"> <i class="fas fa-info-circle me-2"></i>No FAQs found </td> </tr> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> </main> <script> function confirmDelete(id) { if (confirm('Are you sure you want to delete this FAQ?')) { window.location.href = 'delete_faq.php?id=' + id; } } </script> <?php include 'views/admin/layout/footer.php'; ?>