Replace individual includes with include/all.php for consistent configuration and add cookie-based authentication in all.php.

This commit is contained in:
2025-09-25 14:10:01 +02:00
parent 878106f83f
commit dcfe098f35
17 changed files with 40 additions and 23 deletions

View File

@@ -259,6 +259,28 @@
return $pdo;
}
//Set Cookies
$secretKey = 'impossibleatrouvercommeca';
$remoteUser = $_SERVER['REMOTE_USER'] ?? null;
if ($remoteUser) {
$expiration = time() + 3600; // Token is valid for 1 hour
$payload = base64_encode($remoteUser . '|' . $expiration); // Combine user and expiration
$signature = hash_hmac('sha256', $payload, $secretKey);
$cookieValue = $payload . '.' . $signature;
// Set the cookie
setcookie('AuthToken', $cookieValue, [
'expires' => time() + 3600,
'path' => '/',
'domain' => '.appliarmony.net',
'secure' => false, // true quand HTTPS
'httponly' => true,
'samesite' => 'Lax'
]);
}
?>
<!-- MODAL WAIT -->