BLACKSITE
:
216.73.216.140
:
199.188.200.160 / jeddahhousingltd.com
:
Linux server383.web-hosting.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
:
/
home
/
jeddveug
/
www
/
admin
/
Upload File:
files >> /home/jeddveug/www/admin/videos.php
<?php require_once __DIR__ . '/../config/db.php'; // Check authentication if (!isset($_SESSION['admin_id'])) { header('Location: login.php'); exit; } // Handle deletion if (isset($_GET['delete'])) { $id = (int)$_GET['delete']; $stmt = $pdo->prepare("DELETE FROM videos WHERE id = ?"); if ($stmt->execute([$id])) { header('Location: videos.php?msg=deleted'); } else { header('Location: videos.php?msg=error'); } exit; } $admin_page_title = 'Manage Videos'; require_once 'includes/header.php'; // Fetch videos $videos = $pdo->query("SELECT * FROM videos ORDER BY created_at DESC")->fetchAll(); ?> <?php if (isset($_GET['msg'])): ?> <?php if ($_GET['msg'] === 'deleted'): ?> <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert"> <span class="block sm:inline">Video deleted successfully.</span> </div> <?php elseif ($_GET['msg'] === 'added'): ?> <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert"> <span class="block sm:inline">Video added successfully.</span> </div> <?php elseif ($_GET['msg'] === 'error'): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert"> <span class="block sm:inline">Error deleting video.</span> </div> <?php endif; ?> <?php endif; ?> <div class="flex justify-between items-center mb-6"> <h2 class="text-2xl font-bold text-gray-800">YouTube Videos</h2> <a href="video_add.php" class="bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors"> <i class="fas fa-plus mr-2"></i> Add Video </a> </div> <div class="bg-white rounded-xl shadow-sm overflow-hidden"> <div class="overflow-x-auto"> <table class="w-full text-left border-collapse"> <thead> <tr class="bg-gray-50 border-b border-gray-100"> <th class="p-4 text-sm font-semibold text-gray-600">Video</th> <th class="p-4 text-sm font-semibold text-gray-600">Title</th> <th class="p-4 text-sm font-semibold text-gray-600">Status</th> <th class="p-4 text-sm font-semibold text-gray-600">Date Added</th> <th class="p-4 text-sm font-semibold text-gray-600 text-right">Actions</th> </tr> </thead> <tbody class="divide-y divide-gray-100"> <?php if (empty($videos)): ?> <tr> <td colspan="5" class="p-8 text-center text-gray-500">No videos found. Click "Add Video" to add one.</td> </tr> <?php else: ?> <?php foreach ($videos as $video): ?> <tr class="hover:bg-gray-50 transition-colors"> <td class="p-4"> <div class="w-32 h-20 bg-gray-200 rounded overflow-hidden"> <iframe width="100%" height="100%" src="https://www.youtube.com/embed/<?= htmlspecialchars($video['video_id']) ?>" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> </td> <td class="p-4"> <div class="font-medium text-gray-800"><?= htmlspecialchars($video['title']) ?></div> <a href="<?= htmlspecialchars($video['youtube_link']) ?>" target="_blank" class="text-xs text-blue-500 hover:underline"><i class="fas fa-external-link-alt mr-1"></i>View on YouTube</a> </td> <td class="p-4"> <span class="px-2 py-1 text-xs font-semibold rounded-full <?= $video['status'] == 'active' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' ?>"> <?= ucfirst($video['status']) ?> </span> </td> <td class="p-4 text-sm text-gray-600"> <?= date('M j, Y', strtotime($video['created_at'])) ?> </td> <td class="p-4 text-right space-x-2"> <a href="?delete=<?= $video['id'] ?>" onclick="return confirm('Are you sure you want to delete this video?')" class="w-8 h-8 inline-flex items-center justify-center bg-red-100 text-red-600 rounded-lg hover:bg-red-200 transition-colors" title="Delete"> <i class="fas fa-trash-alt"></i> </a> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> </div> <?php require_once 'includes/footer.php'; ?>