<?php
session_start();

if (!isset($_SESSION['student_id'])) {
    header('Location: student_login.php');
    exit;
}

if (!isset($_GET['exam_id'])) {
    die('Exam ID is required.');
}

$exam_id = intval($_GET['exam_id']);

// Set the exam_id in session
$_SESSION['exam_id'] = $exam_id;

// Redirect to take_exam.php
header('Location: take_exam.php');
exit;
?>
