<?php
// =====================================================
// GET /get-last-user.php
// Response: { status, data: { created_at } }
// =====================================================
require_once 'config.php';

$conn = getConnection();

$result = $conn->query("SELECT id FROM users ORDER BY id DESC LIMIT 1");

if ($result->num_rows > 0) {
    echo json_encode([
        "status" => "success",
        "data" => [
            "created_at" => date("Y-m-d H:i:s")
        ]
    ]);
} else {
    echo json_encode([
        "status" => "success",
        "data" => [
            "created_at" => ""
        ]
    ]);
}

$conn->close();
