<?php
declare(strict_types=1);
if (session_status() === PHP_SESSION_NONE) session_start();

$cid  = isset($_GET['course_id']) ? trim($_GET['course_id']) : 'all';
$next = $_GET['next'] ?? '/elms/student/dashboard.php';

if ($cid !== 'all' && !ctype_digit($cid)) $cid = 'all';
$_SESSION['active_course_id'] = $cid;

header('Location: '.$next);
exit;
