diff index.php @ 317:5a902083a216 gmap2

Use PHP cookie options array and set SameSite policy.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 03 Dec 2020 06:26:08 +0200
parents 8e686cda5c6e
children
line wrap: on
line diff
--- a/index.php	Thu Oct 29 08:10:53 2020 +0200
+++ b/index.php	Thu Dec 03 06:26:08 2020 +0200
@@ -43,7 +43,16 @@
 if (isset($_GET["css"]))
 {
   $pageCSSIndex = intval($_GET["css"]);
-  setcookie($pageCSSCookie, $pageCSSIndex, time() + 365*24*60*60, "/"); // expire in a year
+
+  $coptions = [
+    "expires"  => time() + 365*24*60*60,
+    "path"     => "/",
+    "samesite" => "Strict",
+    "secure"   => false,
+    "httponly" => false,
+  ];
+
+  setcookie($pageCSSCookie, $pageCSSIndex, $coptions);
 }
 else
 {