mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 15:20:32 -04:00
23 lines
528 B
PHP
23 lines
528 B
PHP
<?
|
|
require_once('Core.php');
|
|
|
|
use function Safe\strtotime;
|
|
|
|
$colorScheme = $_POST['color-scheme'] ?? 'auto';
|
|
|
|
if($colorScheme !== 'dark' && $colorScheme !== 'light' && $colorScheme !== 'auto'){
|
|
$colorScheme = 'auto';
|
|
}
|
|
|
|
if($colorScheme == 'auto'){
|
|
// Delete the cookie; auto is the default
|
|
setcookie('color-scheme', '', 0, '/', '', true, true);
|
|
}
|
|
else{
|
|
setcookie('color-scheme', $colorScheme, strtotime('+10 years'), '/', '', true, true);
|
|
}
|
|
|
|
// HTTP 303, See other
|
|
http_response_code(303);
|
|
header('Location: /settings');
|
|
?>
|