Files
2026-06-10 22:26:03 +07:00

19 lines
441 B
PHP

<?php
/**
* auth_logout.php — Logout User
* Supports both AJAX (POST) and direct navigation (GET)
*/
session_start();
session_unset();
session_destroy();
// If called via AJAX (POST), return JSON
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
header('Content-Type: application/json');
echo json_encode(['success' => true]);
} else {
// If navigated directly, redirect to login
header('Location: login.html');
exit;
}