<?php
  $cookie_data = array(
    "expires" => "Tue, 31 Dec 2069 23:59:59 GMT",
    "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);
  }
?>
