47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
include 'includes/header.php';
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM challenges ORDER BY RAND() LIMIT 3');
|
|
$featured_challenges = $stmt->fetchAll();
|
|
?>
|
|
|
|
<div class="container-fluid hero-section text-white text-center py-5">
|
|
<h1 class="display-4 fw-bold">Welcome to RS Learning Lab</h1>
|
|
<p class="fs-5">Your platform for coding challenges, competitions, and certificates.</p>
|
|
<div class="d-flex justify-content-center gap-4 mt-4">
|
|
<div class="text-center">
|
|
<i class="bi bi-code-slash fs-1"></i>
|
|
<p class="mb-0">Challenges</p>
|
|
</div>
|
|
<div class="text-center">
|
|
<i class="bi bi-trophy fs-1"></i>
|
|
<p class="mb-0">Competitions</p>
|
|
</div>
|
|
<div class="text-center">
|
|
<i class="bi bi-patch-check fs-1"></i>
|
|
<p class="mb-0">Certificates</p>
|
|
</div>
|
|
</div>
|
|
<a href="challenges.php" class="btn btn-light btn-lg mt-4">Browse Challenges</a>
|
|
</div>
|
|
|
|
<div class="container py-5">
|
|
<h2 class="text-center mb-4">Featured Challenges</h2>
|
|
<div class="row">
|
|
<?php foreach ($featured_challenges as $challenge): ?>
|
|
<div class="col-md-4">
|
|
<div class="card h-100">
|
|
<div class="card-body d-flex flex-column">
|
|
<h5 class="card-title"><?php echo htmlspecialchars($challenge['title']); ?></h5>
|
|
<p class="card-text flex-grow-1"><?php echo htmlspecialchars(substr($challenge['description'], 0, 100)); ?>...</p>
|
|
<a href="challenge.php?id=<?php echo $challenge['id']; ?>" class="btn btn-primary mt-auto">View Challenge</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'includes/footer.php'; ?>
|