<?php
session_start();
require_once 'conexao.php';

if (!isset($_SESSION['usuario_id']) || !isset($_SESSION['tenant_id'])) {
    http_response_code(401);
    exit;
}

$usuario_id = $_SESSION['usuario_id'];
$tenant_id = $_SESSION['tenant_id'];
$agora = date('Y-m-d H:i:s');

$stmt = $conn->prepare("UPDATE usuarios SET ultimo_acesso = ? WHERE id = ? AND tenant_id = ?");
$stmt->bind_param("sis", $agora, $usuario_id, $tenant_id);
$stmt->execute();
$stmt->close();
$conn->close();
?>
