Initial commit - Last War messaging system
This commit is contained in:
31
logout.php
Executable file
31
logout.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/env_loader.php';
|
||||
|
||||
$domain = $_ENV['APP_URL'] ?? getenv('APP_URL') ?? '';
|
||||
if ($domain) {
|
||||
$parsed = parse_url($domain);
|
||||
$host = $parsed['host'] ?? '';
|
||||
if ($host) {
|
||||
session_set_cookie_params([
|
||||
'lifetime' => 0,
|
||||
'path' => '/',
|
||||
'domain' => $host,
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Strict'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
require_once __DIR__ . '/includes/db.php';
|
||||
require_once __DIR__ . '/includes/activity_logger.php';
|
||||
|
||||
logActivity($_SESSION['user_id'], 'logout', 'Usuario cerró sesión');
|
||||
}
|
||||
|
||||
session_destroy();
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
Reference in New Issue
Block a user