DSP Project first push, date: 29/01/2026
This commit is contained in:
25
logout.php
Normal file
25
logout.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// logout.php
|
||||
session_start();
|
||||
session_unset(); // Unset all session variables
|
||||
session_destroy(); // Destroy the session
|
||||
|
||||
require_once 'includes/auth.php'; // For set_message function
|
||||
|
||||
set_message("You have been logged out.", "info");
|
||||
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && strtolower((string) $_SERVER['HTTPS']) !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
$homeUrl = $scheme . '://' . $host . '/index.php';
|
||||
|
||||
$redirectUrl = $homeUrl;
|
||||
|
||||
$jupyterBase = getenv('JUPYTER_EXTERNAL_URL');
|
||||
if (!empty($jupyterBase)) {
|
||||
$hubLogout = rtrim($jupyterBase, '/') . '/hub/logout';
|
||||
$redirectUrl = $hubLogout . '?next=' . urlencode($homeUrl);
|
||||
}
|
||||
|
||||
header("Location: " . $redirectUrl);
|
||||
exit();
|
||||
?>
|
||||
Reference in New Issue
Block a user