Replace individual includes with include/all.php for consistent configuration and add cookie-based authentication in all.php.
This commit is contained in:
@@ -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 -->
|
||||
|
||||
Reference in New Issue
Block a user