<?php
session_start();

header('Content-Type: application/json');

$data = json_decode(file_get_contents('php://input'), true);

if (isset($data['access_code']) && isset($data['exam_subject_id'])) {
    $_SESSION['verified_access_key'] = [
        'code' => $data['access_code'],
        'exam_subject_id' => $data['exam_subject_id'],
        'verified_at' => time()
    ];
    echo json_encode(['success' => true]);
} else {
    echo json_encode(['success' => false]);
}
?>