[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: index.php
<?php require_once 'config/database.php'; // Get public competitions $public_competitions_stmt = $pdo->query(" SELECT c.*, u.full_name as teacher_name, g.name as grade_name, s.name as subject_name FROM competitions c JOIN users u ON c.teacher_id = u.id JOIN grades g ON c.grade_id = g.id JOIN subjects s ON c.subject_id = s.id WHERE c.is_public = 1 AND c.status = 'active' ORDER BY c.created_at DESC LIMIT 10 "); $public_competitions = $public_competitions_stmt->fetchAll(); // Get best students per stage $best_per_stage_stmt = $pdo->query(" SELECT st.name as stage_name, gr.student_name, gr.final_score as best_score FROM game_results gr JOIN competitions c ON gr.competition_id = c.id JOIN grades g ON c.grade_id = g.id JOIN stages st ON g.stage_id = st.id WHERE gr.final_score > 0 GROUP BY st.id, st.name, gr.student_name, gr.final_score ORDER BY st.id, best_score DESC "); $best_per_stage = $best_per_stage_stmt->fetchAll(); // Group by stage $stages_leaderboard = []; foreach ($best_per_stage as $result) { if (!isset($stages_leaderboard[$result['stage_name']])) { $stages_leaderboard[$result['stage_name']] = []; } if (count($stages_leaderboard[$result['stage_name']]) < 5) { $stages_leaderboard[$result['stage_name']][] = $result; } } // Get best students per game type $best_per_type_stmt = $pdo->query(" SELECT game_type, student_name, final_score as best_score FROM game_results WHERE final_score > 0 GROUP BY game_type, student_name, final_score ORDER BY game_type, best_score DESC "); $best_per_type = $best_per_type_stmt->fetchAll(); // Group by game type $type_leaderboard = []; foreach ($best_per_type as $result) { $type_name = $result['game_type'] == 'group' ? 'مسابقة المجموعات' : 'من سيربح المليون'; if (!isset($type_leaderboard[$type_name])) { $type_leaderboard[$type_name] = []; } if (count($type_leaderboard[$type_name]) < 5) { $type_leaderboard[$type_name][] = $result; } } ?> <!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> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> <link href="assets/css/style.css" rel="stylesheet"> </head> <body> <!-- Navigation --> <nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <div class="container"> <a class="navbar-brand" href="index.php"> <i class="fas fa-trophy me-2"></i> منصة المسابقات التعليمية </a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav me-auto"> <li class="nav-item"> <a class="nav-link active" href="index.php">الرئيسية</a> </li> <li class="nav-item"> <a class="nav-link" href="leaderboard.php">لوحة الشرف</a> </li> </ul> <ul class="navbar-nav"> <?php if (isLoggedIn()): ?> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"> <i class="fas fa-user me-1"></i> <?= sanitize($_SESSION['user_name']) ?> </a> <ul class="dropdown-menu"> <?php if (getUserRole() == 'admin'): ?> <li><a class="dropdown-item" href="admin/dashboard.php">لوحة الإدارة</a></li> <?php elseif (getUserRole() == 'teacher'): ?> <li><a class="dropdown-item" href="teacher/dashboard.php">لوحة المعلم</a></li> <?php endif; ?> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="auth/logout.php">تسجيل الخروج</a></li> </ul> </li> <?php else: ?> <li class="nav-item"> <a class="nav-link" href="auth/login.php">تسجيل الدخول</a> </li> <li class="nav-item"> <a class="nav-link" href="auth/register.php">إنشاء حساب</a> </li> <?php endif; ?> </ul> </div> </div> </nav> <!-- Hero Section --> <section class="hero-section bg-gradient-primary text-white py-5" style="min-height: 500px; display: flex; align-items: center;"> <div class="container"> <div class="row align-items-center"> <div class="col-lg-6 mb-4 mb-lg-0"> <h1 class="display-3 fw-bold mb-4 animate__animated animate__fadeInUp">مرحباً بك في منصة المسابقات التعليمية</h1> <p class="lead mb-4 fs-5 animate__animated animate__fadeInUp" style="animation-delay: 0.2s;">اكتشف متعة التعلم من خلال المسابقات التفاعلية والألعاب التعليمية الشيقة</p> <div class="d-flex gap-3 animate__animated animate__fadeInUp" style="animation-delay: 0.4s;"> <a href="#public-competitions" class="btn btn-light btn-lg shadow"> <i class="fas fa-play me-2"></i> ابدأ اللعب الآن </a> <a href="leaderboard.php" class="btn btn-outline-light btn-lg"> <i class="fas fa-trophy me-2"></i> لوحة الشرف </a> </div> </div> <div class="col-lg-6 text-center"> <div class="hero-image animate__animated animate__zoomIn" style="animation-delay: 0.6s;"> <i class="fas fa-graduation-cap" style="font-size: 12rem; color: rgba(255,255,255,0.3);"></i> </div> </div> </div> </div> </section> <!-- Public Competitions Section --> <section id="public-competitions" class="py-5"> <div class="container"> <h2 class="text-center mb-5"> <i class="fas fa-globe me-2"></i> المسابقات المفتوحة </h2> <?php if (empty($public_competitions)): ?> <div class="alert alert-info text-center"> <i class="fas fa-info-circle me-2"></i> لا توجد مسابقات مفتوحة حالياً </div> <?php else: ?> <div class="row"> <?php foreach ($public_competitions as $competition): ?> <div class="col-lg-4 col-md-6 mb-4"> <div class="card competition-card h-100 shadow-sm"> <div class="card-body"> <div class="d-flex justify-content-between align-items-start mb-3"> <h5 class="card-title"><?= sanitize($competition['title']) ?></h5> <span class="badge bg-success">مفتوحة</span> </div> <p class="card-text text-muted mb-2"> <i class="fas fa-user me-1"></i> المعلم: <?= sanitize($competition['teacher_name']) ?> </p> <p class="card-text text-muted mb-2"> <i class="fas fa-book me-1"></i> <?= sanitize($competition['subject_name']) ?> - <?= sanitize($competition['grade_name']) ?> </p> <p class="card-text text-muted mb-3"> <i class="fas fa-gamepad me-1"></i> نوع المسابقة: <?= $competition['competition_type'] == 'group' ? 'مسابقة المجموعات' : 'من سيربح المليون' ?> </p> </div> <div class="card-footer bg-transparent"> <button class="btn btn-primary w-100 start-public-game" data-competition-id="<?= $competition['id'] ?>" data-competition-type="<?= $competition['competition_type'] ?>"> <i class="fas fa-play me-2"></i> ابدأ اللعب </button> </div> </div> </div> <?php endforeach; ?> </div> <?php endif; ?> </div> </section> <!-- Leaderboards Section --> <section class="py-5 bg-light"> <div class="container"> <h2 class="text-center mb-5"> <i class="fas fa-crown me-2"></i> لوحة الشرف </h2> <div class="row"> <!-- Best per Stage --> <div class="col-lg-6 mb-4"> <div class="card h-100"> <div class="card-header bg-primary text-white"> <h5 class="mb-0"> <i class="fas fa-school me-2"></i> أفضل الطلاب حسب المرحلة </h5> </div> <div class="card-body"> <?php foreach ($stages_leaderboard as $stage_name => $students): ?> <h6 class="fw-bold text-primary"><?= sanitize($stage_name) ?></h6> <ul class="list-group list-group-flush mb-3"> <?php foreach (array_slice($students, 0, 3) as $index => $student): ?> <li class="list-group-item d-flex justify-content-between align-items-center"> <span> <i class="fas fa-medal text-warning me-2"></i> <?= sanitize($student['student_name']) ?> </span> <span class="badge bg-success"><?= $student['best_score'] ?> نقطة</span> </li> <?php endforeach; ?> </ul> <?php endforeach; ?> </div> </div> </div> <!-- Best per Game Type --> <div class="col-lg-6 mb-4"> <div class="card h-100"> <div class="card-header bg-success text-white"> <h5 class="mb-0"> <i class="fas fa-gamepad me-2"></i> أفضل الطلاب حسب نوع اللعبة </h5> </div> <div class="card-body"> <?php foreach ($type_leaderboard as $type_name => $students): ?> <h6 class="fw-bold text-success"><?= sanitize($type_name) ?></h6> <ul class="list-group list-group-flush mb-3"> <?php foreach (array_slice($students, 0, 3) as $index => $student): ?> <li class="list-group-item d-flex justify-content-between align-items-center"> <span> <i class="fas fa-trophy text-warning me-2"></i> <?= sanitize($student['student_name']) ?> </span> <span class="badge bg-primary"><?= $student['best_score'] ?> نقطة</span> </li> <?php endforeach; ?> </ul> <?php endforeach; ?> </div> </div> </div> </div> <div class="text-center mt-4"> <a href="leaderboard.php" class="btn btn-outline-primary btn-lg"> <i class="fas fa-list me-2"></i> عرض لوحة الشرف الكاملة </a> </div> </div> </section> <!-- Footer --> <footer class="bg-dark text-white py-4"> <div class="container"> <div class="row"> <div class="col-md-6"> <h5>منصة المسابقات التعليمية</h5> <p>منصة تفاعلية للتعلم من خلال المسابقات والألعاب التعليمية</p> </div> <div class="col-md-6 text-md-end"> <p>© 2024 جميع الحقوق محفوظة</p> </div> </div> </div> </footer> <!-- Public Game Entry Modal --> <div class="modal fade" id="publicGameModal" tabindex="-1"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">معلومات اللاعبين</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body" id="modalContent"> <!-- Dynamic content will be loaded here --> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">إلغاء</button> <button type="button" class="btn btn-primary" id="startGameBtn">ابدأ اللعب</button> </div> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script src="assets/js/main.js"></script> <script> $(document).ready(function() { // Handle public game start $('.start-public-game').click(function() { const competitionId = $(this).data('competition-id'); const competitionType = $(this).data('competition-type'); // Load appropriate form based on competition type $.post('ajax/get_public_game_form.php', { competition_id: competitionId, competition_type: competitionType }, function(response) { const data = JSON.parse(response); if (data.success) { $('#modalContent').html(data.html); $('#publicGameModal').modal('show'); // Store competition data for later use $('#startGameBtn').data('competition-id', competitionId); $('#startGameBtn').data('competition-type', competitionType); } }); }); // Handle start game button $('#startGameBtn').click(function() { const competitionId = $(this).data('competition-id'); const competitionType = $(this).data('competition-type'); // Collect form data const formData = {}; if (competitionType === 'group') { // Collect group names formData.groups = []; $('.group-students').each(function(index) { const groupStudents = []; $(this).find('input').each(function() { if ($(this).val().trim()) { groupStudents.push($(this).val().trim()); } }); if (groupStudents.length > 0) { formData.groups.push({ name: 'المجموعة ' + (index + 1), students: groupStudents }); } }); } else { // Collect player name for millionaire formData.player_name = $('#playerName').val().trim(); } // Validate data if (competitionType === 'group' && formData.groups.length === 0) { alert('يرجى إدخال أسماء الطلاب في المجموعات'); return; } if (competitionType === 'millionaire' && !formData.player_name) { alert('يرجى إدخال اسم اللاعب'); return; } // Start the game const gameUrl = competitionType === 'group' ? 'games/group_game.php' : 'games/millionaire_game.php'; // Store data in session and redirect $.post('ajax/start_public_game.php', { competition_id: competitionId, competition_type: competitionType, game_data: JSON.stringify(formData) }, function(response) { const result = JSON.parse(response); if (result.success) { window.location.href = gameUrl + '?public=1&competition=' + competitionId; } else { alert('حدث خطأ في بدء اللعبة'); } }); }); }); </script> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.87 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285