<?php
session_start();

$_SESSION['reinforcement_index']++;

$name  = $_GET['name'] ?? 'Student';
$roll  = $_GET['roll'] ?? 'NA';
$class = $_GET['class'] ?? '';
$lang  = $_GET['lang'] ?? 'python';
$concept_id = $_GET['concept_id'] ?? 1;

if($_SESSION['reinforcement_index'] < count($_SESSION['reinforcement_questions'])){
    header("Location: reinforcement_track.php?name=$name&roll=$roll&class=$class&lang=$lang&concept_id=$concept_id");
} else {
    unset($_SESSION['reinforcement_questions']);
    unset($_SESSION['reinforcement_index']);

    header("Location: final_track.php?name=$name&roll=$roll&class=$class&lang=$lang&concept_id=$concept_id");
}
exit;
