mirror of
git://f0xx.org/ac/ac-platform-php
synced 2026-07-29 01:37:53 +03:00
23 lines
669 B
PHP
23 lines
669 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Shared session for all Android Cast web consoles (crashes, build, …).
|
|
* Same cookie path + session name => one login across sub-apps.
|
|
*/
|
|
function platform_start_session(string $sessionName = 'ac_crash_sess', string $cookiePath = '/app/androidcast_project'): void
|
|
{
|
|
if (session_status() === PHP_SESSION_ACTIVE) {
|
|
return;
|
|
}
|
|
session_name($sessionName);
|
|
session_set_cookie_params([
|
|
'lifetime' => 0,
|
|
'path' => $cookiePath,
|
|
'httponly' => true,
|
|
'samesite' => 'Lax',
|
|
'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
|
|
]);
|
|
session_start();
|
|
}
|