pub / serci

Search the web with !keywords
git clone https://https://src.jayvii.de/pub/serci.git
Home | Log | Files | Exports | Refs | README | RSS

commit b310483a07df3aa8c75fa4917a34d90cbb3d31e6
parent 6b0d4d2b6763d296fda41495cb78c670932df952
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Wed, 16 Oct 2024 23:14:32 +0200

fix: set cookie with strict same site rule

Diffstat:
Mindex.php | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/index.php b/index.php @@ -28,10 +28,12 @@ } elseif (!is_null($_COOKIE["default_search"])) { $default_search = $_COOKIE["default_search"]; /* refresh cookie */ - setcookie( - "default_search", - $default_search, - time() + (60 * 60 * 24 * 365) + header( + "Set-Cookie: " . + "default_search=" . $default_search . "; " . + "Max-Age=" . 31536000 . "; " . /* 60 x 60 x 24 x 365 = 1 year */ + "Domain=" . $_SERVER["SERVER_NAME"] . "; " . + "SameSite=Strict;" ); } @@ -248,7 +250,9 @@ let expires = "expires="+ d.toUTCString(); // Set a cookie for the selection document.cookie = "default_search=" + selection + ";" + - expires + ";SameSite=Strict;"; + "Max-Age=31536000;" + // 60 x 60 x 24 x 365 = 1 year + "Domain=" + document.domain + ";" + + "SameSite=Strict;"; } </script>