D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
skyconb
/
newsyacine
/
Filename :
video.php
back
Copy
<?php // =============================================== // video.php (قائمة الفيديوهات - Video) - مصحح // =============================================== include 'db_connect.php'; include 'ad_helpers.php'; // 1. تعريف المتغير $base_url (لحَل مشكلة Undefined variable) $path_prefix = "/"; $base_url = "http://" . $_SERVER['HTTP_HOST'] . $path_prefix; // 2. جلب جميع الفيديوهات من قاعدة البيانات $sql = "SELECT id, title, thumbnail_url, description FROM videos ORDER BY id DESC"; $result = $conn->query($sql); ?> <!DOCTYPE html> <html lang="ar" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>قائمة الفيديوهات والقنوات</title> <style> /* تصميم الشريط العلوي ومكوناته - موحد في كل الصفحات */ body { font-family: Tahoma, sans-serif; margin: 0; background-color: #f0f2f5; } .header { background-color: #2c3e50; color: white; padding: 10px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.2); } .header .logo h1 { margin: 0; font-size: 1.8em; color: #f39c12; } .main-nav ul { list-style: none; padding: 0; margin: 0; display: flex; } .main-nav ul li { margin: 0 15px; } .main-nav ul li a { color: white; text-decoration: none; font-size: 1.1em; padding: 8px 0; transition: color 0.3s, border-bottom 0.3s; border-bottom: 2px solid transparent; } .main-nav ul li a:hover, .main-nav ul li a.active { color: #f39c12; border-bottom: 2px solid #f39c12; } .admin-link a { color: #3498db; text-decoration: none; padding: 8px 15px; border: 1px solid #3498db; border-radius: 4px; transition: background-color 0.3s, color 0.3s; } .admin-link a:hover { background-color: #3498db; color: white; } /* تصميم شبكة الفيديوهات */ .container { max-width: 1200px; margin: 30px auto; padding: 0 20px; } .video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; } .video-item { background-color: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); transition: transform 0.3s; text-align: right; } .video-item:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .video-item img { width: 100%; height: 180px; object-fit: cover; display: block; } .video-info { padding: 15px; } .video-info h3 { margin-top: 0; color: #2c3e50; font-size: 1.2em; } .video-info p { color: #7f8c8d; font-size: 0.9em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 36px; } .watch-link { display: block; text-align: center; background-color: #3498db; color: white; padding: 10px; text-decoration: none; border-radius: 4px; margin-top: 10px; transition: background-color 0.3s; } .watch-link:hover { background-color: #2980b9; } .ad-placeholder { min-height: 200px; display: flex; align-items: center; justify-content: center; text-align: center; background-color: #f9f9f9; border: 1px dashed #ccc; border-radius: 8px; padding: 10px; } </style> </head> <body> <div class="header"> <div class="logo"> <h1>بث مباشر</h1> </div> <nav class="main-nav"> <ul> <li><a href="<?php echo $base_url; ?>">الرئيسية</a></li> <li><a href="<?php echo $base_url . 'articles_list.php'; ?>">الاخبار</a></li> <li><a href="<?php echo $base_url . 'video.php'; ?>">مباشر</a></li> </ul> </nav> </div> <div class="container"> <div style="margin-bottom: 25px; text-align: center;"> <?php display_ad($conn, 'index_top'); ?> </div> <?php if ($result->num_rows > 0): ?> <div class="video-grid"> <?php $counter = 0; while($row = $result->fetch_assoc()): // تحديد مسار الصورة المصغرة (باستخدام $base_url) $video_thumb_url = !empty($row['thumbnail_url']) ? (strpos($row['thumbnail_url'], 'http') === 0 ? $row['thumbnail_url'] : $base_url . htmlspecialchars($row['thumbnail_url'])) : $base_url . 'default_video_thumb.jpg'; ?> <div class="video-item"> <img src="<?php echo $video_thumb_url; ?>" alt="<?php echo htmlspecialchars($row['title']); ?>"> <div class="video-info"> <h3><?php echo htmlspecialchars($row['title']); ?></h3> <p><?php echo htmlspecialchars($row['description']); ?></p> <a href="watch.php?id=<?php echo $row['id']; ?>" class="watch-link">مشاهدة الآن</a> </div> </div> <?php $counter++; // عرض إعلان بعد كل 4 فيديوهات if ($counter % 4 == 0): ?> <div class="video-item ad-placeholder"> <?php display_ad($conn, 'index_middle'); ?> </div> <?php endif; endwhile; ?> </div> <?php else: ?> <p style="text-align: center; padding: 50px; background: white; border-radius: 8px;">لا توجد فيديوهات متاحة للمشاهدة حالياً.</p> <?php endif; ?> </div> </body> </html> <?php $conn->close(); ?>