4096 || str_contains($value, "\0")) { http_response_code(400); header('Cache-Control: no-store'); exit('invalid request field.'); } } } // Preferences are untrusted browser input. Invalid values use the existing defaults. foreach (['dark_mode'=>['on','off'], 'dynamic_color'=>['on','off'], 'blur_covers'=>['on','off'], 'flip_page_order'=>['ltr','rtl'], 'home_sort'=>['na','nu']] as $key=>$allowed) { if (isset($_COOKIE[$key]) && !in_array($_COOKIE[$key], $allowed, true)) unset($_COOKIE[$key]); } }