🤩 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:reviews.php
<?php $page = 'reviews'; $page_title = 'Reviews'; require_once '../includes/header.php'; if (isset($_GET['approve'])) { $db->prepare("UPDATE reviews SET status = 1 WHERE id = ?")->execute([intval($_GET['approve'])]); admin_set_flash('success', 'Review approved'); header('Location: ' . ADMIN_PATH . 'pages/reviews.php'); exit; } if (isset($_GET['reject'])) { $db->prepare("UPDATE reviews SET status = 0 WHERE id = ?")->execute([intval($_GET['reject'])]); admin_set_flash('success', 'Review rejected'); header('Location: ' . ADMIN_PATH . 'pages/reviews.php'); exit; } if (isset($_GET['delete'])) { $db->prepare("DELETE FROM reviews WHERE id = ?")->execute([intval($_GET['delete'])]); admin_set_flash('success', 'Review deleted'); header('Location: ' . ADMIN_PATH . 'pages/reviews.php'); exit; } $reviews = $db->query("SELECT r.*, p.name as product_name, p.thumbnail, p.slug FROM reviews r LEFT JOIN products p ON r.product_id = p.id ORDER BY r.created_at DESC")->fetchAll(); ?> <div class="data-table-wrapper"> <h3 style="margin-bottom: 20px; font-size: 1.2rem;">All Reviews (<?= count($reviews) ?>)</h3> <div class="table-responsive"> <table class="admin-table"> <thead> <tr> <th>Product</th> <th>Customer</th> <th>Rating</th> <th>Review</th> <th>Status</th> <th>Date</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($reviews as $r): ?> <tr> <td> <div style="display: flex; gap: 10px; align-items: center;"> <?php if ($r['thumbnail']): ?> <img src="<?= UPLOADS_URL ?>products/<?= $r['thumbnail'] ?>" style="width: 40px; height: 40px; border-radius: 6px; object-fit: cover;"> <?php endif; ?> <span><?= htmlspecialchars($r['product_name']) ?></span> </div> </td> <td> <strong><?= htmlspecialchars($r['name']) ?></strong> <div><small class="text-muted"><?= htmlspecialchars($r['email']) ?></small></div> </td> <td> <div style="color: #ffc107;"> <?php for ($i = 1; $i <= 5; $i++): ?> <i class="fa<?= $i <= $r['rating'] ? 's' : 'r' ?> fa-star"></i> <?php endfor; ?> </div> </td> <td style="max-width: 300px;"> <?php if ($r['title']): ?><strong><?= htmlspecialchars($r['title']) ?></strong><br><?php endif; ?> <small><?= htmlspecialchars(substr($r['review'], 0, 100)) ?>...</small> </td> <td> <span class="status-badge status-<?= $r['status'] ? 'active' : 'pending' ?>"> <?= $r['status'] ? 'Approved' : 'Pending' ?> </span> </td> <td><?= date('M d, Y', strtotime($r['created_at'])) ?></td> <td> <div class="action-buttons"> <?php if (!$r['status']): ?> <a href="?approve=<?= $r['id'] ?>" class="btn-icon btn-admin btn-success-admin" data-bs-toggle="tooltip" title="Approve"> <i class="fas fa-check"></i> </a> <?php else: ?> <a href="?reject=<?= $r['id'] ?>" class="btn-icon btn-admin btn-secondary-admin" data-bs-toggle="tooltip" title="Unapprove"> <i class="fas fa-times"></i> </a> <?php endif; ?> <a href="?delete=<?= $r['id'] ?>" class="btn-icon btn-admin btn-danger-admin confirm-delete" data-bs-toggle="tooltip" title="Delete"> <i class="fas fa-trash"></i> </a> </div> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <?php require_once '../includes/footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder