<?php
include '../../includes/conn.php';
include '../../includes/functions.php';
requireRole('admin');

if(!isset($_POST['exam_id'], $_POST['status'])) {
    echo 'error';
    exit;
}

$exam_id = intval($_POST['exam_id']);
$status = intval($_POST['status']);

// Update exam status
$stmt = $pdo->prepare("UPDATE cbt_exams SET status = ? WHERE id = ?");
if($stmt->execute([$status, $exam_id])){
    echo 'success';
} else {
    echo 'error';
}
