36459-vm/tracks/reinforcement.php
2026-05-27 14:29:58 +05:30

50 lines
1.1 KiB
PHP

<?php
require_once __DIR__ . '/../includes/auth_check.php';
session_start();
if (!isset($_SESSION['practice_completed'])) {
header("Location: practice.php");
exit;
}
$_SESSION['reinforce_attempts'] = $_SESSION['reinforce_attempts'] ?? 0;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$_SESSION['reinforce_attempts']++;
if ($_SESSION['reinforce_attempts'] >= 2) {
$_SESSION['badge_earned'] = true;
header("Location: final.php");
exit;
}
$message = "Good try! 💪 Think again. You have one more attempt.";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Reinforcement Track</title>
<link rel="stylesheet" href="../style.css">
</head>
<body class="dark">
<h1>Reinforcement Track</h1>
<p>Strengthen logic. Badge unlocks here.</p>
<?php if (isset($message)) echo "<p class='hint'>$message</p>"; ?>
<form method="post">
<p>What is the output of: 5 + 3 * 2 ?</p>
<label><input type="radio" name="ans" required> 16</label><br>
<label><input type="radio" name="ans"> 11</label><br>
<label><input type="radio" name="ans"> 13</label><br>
<br>
<button type="submit">Submit</button>
</form>
</body>
</html>