update
This commit is contained in:
@@ -27,7 +27,38 @@ if (!function_exists('desktop_configure_session_storage')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('desktop_configure_session_cookie')) {
|
||||
function desktop_configure_session_cookie(): void
|
||||
{
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
session_name('desktop_kusche_sid');
|
||||
|
||||
$isHttps = false;
|
||||
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||
$isHttps = true;
|
||||
}
|
||||
|
||||
$forwardedProto = trim((string) ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? ''));
|
||||
if ($forwardedProto !== '') {
|
||||
$isHttps = strtolower(trim(explode(',', $forwardedProto)[0] ?? '')) === 'https';
|
||||
}
|
||||
|
||||
session_set_cookie_params([
|
||||
'lifetime' => 0,
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => $isHttps,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
desktop_configure_session_storage();
|
||||
desktop_configure_session_cookie();
|
||||
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$prefixes = [
|
||||
|
||||
Reference in New Issue
Block a user