diff --git a/include/all.php b/include/all.php
index 7b50df8..151587f 100644
--- a/include/all.php
+++ b/include/all.php
@@ -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'
+ ]);
+ }
+
?>
diff --git a/index.php b/index.php
index 83c396f..3d209c2 100644
--- a/index.php
+++ b/index.php
@@ -25,7 +25,7 @@
-
+