D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
skyconb
/
newsyacine
/
Filename :
index.php
back
Copy
<?php // =============================================== // index.php (الصفحة الرئيسية - مع Nav Menu والبانر وعرض Thumbnail) // =============================================== include 'db_connect.php'; // 🎯 تحديد المسار الأساسي $path_prefix = "/"; $base_url = "http://" . $_SERVER['HTTP_HOST'] . $path_prefix; // 1. جلب أحدث 3 مقالات $articles = []; $articles_sql = "SELECT a.title, a.slug, a.content, a.thumbnail_url, u.username FROM articles a LEFT JOIN users u ON a.author_id = u.id ORDER BY a.created_at DESC LIMIT 3"; $articles_result = $conn->query($articles_sql); if ($articles_result && $articles_result->num_rows > 0) { while($row = $articles_result->fetch_assoc()) { $articles[] = $row; } } // 2. جلب أحدث 3 فيديوهات $videos = []; // 🎯 التعديل: إضافة thumbnail_url إلى جملة SELECT $videos_sql = "SELECT id, title, iframe_link, thumbnail_url FROM videos ORDER BY upload_date DESC LIMIT 3"; $videos_result = $conn->query($videos_sql); if ($videos_result && $videos_result->num_rows > 0) { while($row = $videos_result->fetch_assoc()) { $videos[] = $row; } } $conn->close(); $page_title = ""; $banner_image = $base_url . "Yacine-Kora-Live-Banner.jpg"; ?> <!DOCTYPE html> <html lang="ar" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?php echo $page_title; ?></title> <style> body { font-family: Tahoma, sans-serif; line-height: 1.6; color: #333; background-color: #f4f4f4; margin: 0; padding-top: 60px; } /* شريط التنقل */ .main-nav { position: fixed; top: 0; right: 0; left: 0; background-color: #2c3e50; padding: 10px 0; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 1000; } .main-nav ul { max-width: 900px; margin: 0 auto; list-style: none; padding: 0 20px; display: flex; justify-content: flex-start; } .main-nav ul li a { color: white; text-decoration: none; padding: 10px 15px; transition: background-color 0.3s; margin-left: 10px; font-weight: bold; border-radius: 4px; } .main-nav ul li a:hover { background-color: #34495e; } /* البانر الكبير */ .main-banner { width: 100%; height: 300px; background-image: url('<?php echo $banner_image; ?>'); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: white; font-size: 2.5em; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.7); margin-bottom: 30px; } .container { max-width: 900px; margin: 0 auto; padding: 0 20px 30px; } .section-header { border-bottom: 2px solid #ff0d0d; padding-bottom: 10px; margin-bottom: 20px; color: #ff0d0d; } .content-grid { display: flex; gap: 20px; margin-bottom: 40px; } .card { flex: 1; background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); overflow: hidden; text-align: right; transition: transform 0.3s; } .card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); } .card img { width: 100%; height: 150px; object-fit: cover; } .card-body { padding: 15px; } .card-body h3 { margin-top: 0; font-size: 1.1em; color: #34495e; min-height: 40px; } .card-body a { text-decoration: none; color: #ff0d0d; font-weight: bold; display: block; margin-top: 10px; } .no-content { background: white; padding: 20px; border-radius: 8px; text-align: center; } </style> </head> <body> <nav class="main-nav"> <ul> <li><a href="<?php echo $base_url . 'index.php'; ?>">الرئيسية</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 class="main-banner"> <span></span> </div> <div class="container"> <h2 class="section-header">📺 بث مباشر</h2> <div class="content-grid"> <?php if (!empty($videos)): ?> <?php foreach ($videos as $video): $link = "watch.php?id=" . $video['id']; // 🎯 التعديل: استخدام مسار الصورة المصغرة المخزن $video_thumb_url = !empty($video['thumbnail_url']) ? $base_url . htmlspecialchars($video['thumbnail_url']) : $base_url . 'default_video_thumb.jpg'; ?> <div class="card"> <img src="<?php echo $video_thumb_url; ?>" alt="<?php echo htmlspecialchars($video['title']); ?>"> <div class="card-body"> <h3><?php echo htmlspecialchars($video['title']); ?></h3> <a href="<?php echo $link; ?>">مشاهدة الآن »</a> </div> </div> <?php endforeach; ?> <?php else: ?> <div class="no-content" style="width: 100%;"> <p>لا توجد فيديوهات أو بثوث متاحة حالياً.</p> </div> <?php endif; ?> </div> <h2 class="section-header">📰 الاخبار</h2> <div class="content-grid"> <?php if (!empty($articles)): ?> <?php foreach ($articles as $article): $image_url = $article['thumbnail_url'] ? $base_url . htmlspecialchars($article['thumbnail_url']) : $base_url . 'default_article_thumb.jpg'; $summary = strip_tags($article['content']); $summary = (strlen($summary) > 50) ? mb_substr($summary, 0, 47, 'utf-8') . '...' : $summary; ?> <div class="card"> <img src="<?php echo $image_url; ?>" alt="<?php echo htmlspecialchars($article['title']); ?>"> <div class="card-body"> <h3><?php echo htmlspecialchars($article['title']); ?></h3> <p style="font-size: 0.9em; color: #7f8c8d;"><?php echo $summary; ?></p> <a href="article.php?slug=<?php echo htmlspecialchars($article['slug']); ?>">قراءة المزيد »</a> </div> </div> <?php endforeach; ?> <?php else: ?> <div class="no-content" style="width: 100%;"> <p>لا توجد مقالات إخبارية متاحة حالياً.</p> </div> <?php endif; ?> </div> </div> </body> </html>