<?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);
  }
?>
