slackware.uk/html/toggletheme.php

21 lines
502 B
PHP

<?php
require ("includes/vars.php");
$cookie_data = array(
"expires" => "Tue, 31 Dec 2069 23:59:59 GMT",
"domain" => ".slackware.uk",
"path" => "/",
"httponly" => true,
"samesite" => "Lax"
);
if (!$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);
}
?>