<?php

$theme = $_POST["theme"] ?? exit(msg_error("Missing required field 'theme'") ?? 1);
$next = $_POST["next"] ?? ".";
setcookie("theme", $theme, time()+60*60*24*30);
header("Location: $next");