<?php
session_start();
header("Content-Type: application/json");

if (isset($_SESSION["user_id"]) && isset($_SESSION["user"])) {
    echo json_encode([
        "connected" => true,
        "username" => $_SESSION["user"],
        "id" => $_SESSION["user_id"]
    ]);
} else {
    echo json_encode(["connected" => false]);
}
