1
0
Fork 0
staging.seedbox.slackware.uk/html/toggletheme.php

20 lines
492 B
PHP

<?php
$cookie_data = array(
"expires" => mktime (23, 59, 59, 12, 31, 2069),
"domain" => ".slackware.uk",
"path" => "/",
"httponly" => true,
"samesite" => "Lax"
);
if ($_COOKIE['theme'] != "light") {
$theme = "light";
} else {
$theme = "dark";
}
setcookie ("theme", $theme, $cookie_data);
if (isset ($_SERVER['HTTP_REFERER'])) {
header ("Location: " . $_SERVER['HTTP_REFERER'], true, 302);
} else {
header ("Location: /", true, 302);
}
?>