66 lines
2.7 KiB
PHP
66 lines
2.7 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
// If player name is submitted, save it in the session
|
|
if (isset($_POST['player_name']) && !empty(trim($_POST['player_name']))) {
|
|
$_SESSION['player_name'] = htmlspecialchars(trim($_POST['player_name']));
|
|
}
|
|
|
|
// If player name is not in session, redirect to index
|
|
if (!isset($_SESSION['player_name'])) {
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
$playerName = $_SESSION['player_name'];
|
|
$levels = 8;
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Ilook - Select a Level</title>
|
|
<meta name="description" content="Select a level to start playing Ilook.">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="text-center my-4">
|
|
<h1 class="display-5">Hello, <?php echo $playerName; ?>!</h1>
|
|
<p class="lead">Select a level to begin.</p>
|
|
</div>
|
|
|
|
<div class="row justify-content-center">
|
|
<?php for ($i = 1; $i <= $levels; $i++): ?>
|
|
<div class="col-6 col-md-4 col-lg-3 mb-4">
|
|
<div class="card level-card">
|
|
<?php if ($i === 1): ?>
|
|
<a href="game.php?level=<?php echo $i; ?>" class="level-link">
|
|
<img src="https://picsum.photos/seed/level<?php echo $i; ?>/400/300" class="card-img-top" alt="Level <?php echo $i; ?>">
|
|
<div class="card-body text-center">
|
|
<h5 class="card-title">Level <?php echo $i; ?></h5>
|
|
</div>
|
|
</a>
|
|
<?php else: ?>
|
|
<div class="level-locked">
|
|
<img src="https://picsum.photos/seed/level<?php echo $i; ?>/400/300" class="card-img-top" alt="Level <?php echo $i; ?> (Locked)">
|
|
<div class="card-body text-center">
|
|
<h5 class="card-title">Level <?php echo $i; ?></h5>
|
|
</div>
|
|
<div class="locked-overlay">
|
|
<i class="fas fa-lock"></i>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endfor; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
|
|
</body>
|
|
</html>
|