26 lines
716 B
PHP
26 lines
716 B
PHP
<?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();
|
|
?>
|