<?php

require_once 'TwoFactorAuth.php';

if (!isset($_SESSION['user_id'])) {
    exit;
}

try {
    $stmt = $conn->prepare("SELECT is_enabled FROM two_factor_auth WHERE user_id = ?");
    $stmt->execute([$_SESSION['user_id']]);
    $twoFaStatus = $stmt->fetch(PDO::FETCH_COLUMN);
} catch(PDOException $e) {
    error_log("Error checking 2FA status: " . $e->getMessage());
    $twoFaStatus = false;
}