🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:local-tours.php
<?php include 'auth.php'; include '../includes/header.php'; // Auto-migrate local_tour_gallery table if missing $conn->query("CREATE TABLE IF NOT EXISTS local_tour_gallery ( id INT AUTO_INCREMENT PRIMARY KEY, tour_id INT NOT NULL, image VARCHAR(255) NOT NULL, FOREIGN KEY (tour_id) REFERENCES local_tours(id) ON DELETE CASCADE )"); // Handle Delete if (isset($_GET['delete'])) { $del_id = (int)$_GET['delete']; $conn->query("DELETE FROM local_tours WHERE id = $del_id"); header("Location: local-tours.php"); exit(); } $tours = $conn->query("SELECT * FROM local_tours ORDER BY id DESC"); ?> <div class="container-fluid py-4"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2 class="fw-bold mb-0">Manage Local Tours</h2> <a href="add-local-tour.php" class="btn btn-primary rounded-pill px-4 shadow-sm"> <i class="fas fa-plus me-2"></i> Add New Tour </a> </div> <div class="card border-0 shadow-sm" style="border-radius: 20px;"> <div class="card-body p-4"> <div class="table-responsive"> <table class="table table-hover align-middle"> <thead class="table-light"> <tr> <th>Image</th> <th>Title</th> <th>Location</th> <th>Price</th> <th class="text-end">Actions</th> </tr> </thead> <tbody> <?php if($tours && $tours->num_rows > 0): ?> <?php while($t = $tours->fetch_assoc()): ?> <tr> <td> <?php if($t['main_image']): ?> <img src="../uploads/<?= $t['main_image'] ?>" height="50" class="rounded"> <?php else: ?> <div class="bg-light rounded text-center d-flex align-items-center justify-content-center" style="width: 50px; height: 50px;"> <i class="fas fa-image text-muted"></i> </div> <?php endif; ?> </td> <td><span class="fw-bold"><?= htmlspecialchars($t['title']) ?></span></td> <td><span class="badge bg-light text-dark"><?= htmlspecialchars($t['location']) ?></span></td> <td><span class="text-primary fw-bold">LKR <?= number_format($t['price'], 0) ?></span></td> <td class="text-end"> <div class="btn-group shadow-sm" style="border-radius: 10px; overflow: hidden;"> <a href="edit-local-tour.php?id=<?= $t['id'] ?>" class="btn btn-light btn-sm px-3"> <i class="fas fa-edit text-primary"></i> </a> <a href="local-tours.php?delete=<?= $t['id'] ?>" class="btn btn-light btn-sm px-3" onclick="return confirm('Are you sure?')"> <i class="fas fa-trash text-danger"></i> </a> </div> </td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="5" class="text-center py-5"> <img src="https://illustrations.popsy.co/gray/empty-folder.svg" style="width: 150px; opacity: 0.5;"> <p class="mt-3 text-muted">No local tours found. Click "Add New Tour" to get started.</p> </td> </tr> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> <?php include '../includes/footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder