<?php
// check_auth_status.php
session_start();

$response = [
    'loggedIn' => isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true
];

if ($response['loggedIn']) {
    $response['user'] = [
        'user_id' => $_SESSION['user_id'] ?? 0,
        'email' => $_SESSION['user_email'] ?? '',
        'full_name' => $_SESSION['full_name'] ?? '',
        'is_admin' => $_SESSION['isAdmin'] ?? false,
        'login_time' => $_SESSION['login_time'] ?? time()
    ];
}

header('Content-Type: application/json');
echo json_encode($response);
?>