Update Project 3 files
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?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;
|
||||
}
|
||||
Reference in New Issue
Block a user