<?php
/**
 * End server session when the PWA reopens without a client tab marker.
 * Called from JS in standalone mode only (see pwa-gate-head.php).
 */
header('Cache-Control: no-store, no-cache, must-revalidate, private');

require_once __DIR__ . '/init.php';
require_once __DIR__ . '/../includes/auth.php';

if (!empty($_SESSION['user_id'])) {
    logout();
}

$msg = 'For your security, sign in again after closing the app.';
header('Location: ' . BASE_PATH . '/mobile/login?toast_error=' . rawurlencode($msg));
exit;
