<?php
// Simple health check endpoint — no auth required.
// LoginActivity polls this to show server status before login.
require_once __DIR__ . '/../config/cors.php';

$dbOk = false;
try {
    require_once __DIR__ . '/../config/db.php';
    $pdo->query('SELECT 1');
    $dbOk = true;
} catch (Exception $e) {
    // DB failed — still respond so app knows server is reachable
}

echo json_encode([
    'status' => 'ok',
    'db'     => $dbOk ? 'connected' : 'error',
    'ts'     => time(),
]);
