<?php
http_response_code(200);
header('X-Robots-Tag: noindex, nofollow');
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Content-Type: text/html; charset=utf-8');
$host = strtolower(preg_replace('/^www\./', '', $_SERVER['HTTP_HOST'] ?? ''));
$seed = sprintf('%u', crc32($host));
$messages = [
    ['503 Service Unavailable', '503 Service Unavailable'],
    ['404 Not Found', '404 Not Found'],
    ['403 Forbidden', '403 Forbidden'],
    ['500 Internal Server Error', '500 Internal Server Error'],
    ['502 Bad Gateway', '502 Bad Gateway'],
    ['504 Gateway Timeout', '504 Gateway Timeout'],
    ['Service Unavailable', 'Service Unavailable'],
    ['Temporarily Unavailable', 'Temporarily Unavailable'],
    ['Unavailable', 'Unavailable'],
    ['Error', 'Error'],
    ['Not Found', 'Not Found'],
    ['Forbidden', 'Forbidden']
];
$m = $messages[$seed % count($messages)];
$title = htmlspecialchars($m[0], ENT_QUOTES, 'UTF-8');
$h1 = htmlspecialchars($m[1], ENT_QUOTES, 'UTF-8');
$template = $seed % 6;
if ($template === 0) {
?><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title><?php echo $title; ?></title>
</head>
<body>
<h1><?php echo $h1; ?></h1>
</body>
</html>
<?php } elseif ($template === 1) {
?><!doctype html>
<html>
<head>
<title><?php echo $title; ?></title>
<meta name="robots" content="noindex, nofollow">
<meta charset="utf-8">
</head>
<body>
<h1><?php echo $h1; ?></h1>
</body>
</html>
<?php } elseif ($template === 2) {
?><!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $title; ?></title>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow">
</head>
<body><h1><?php echo $h1; ?></h1></body>
</html>
<?php } elseif ($template === 3) {
?><html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title><?php echo $title; ?></title>
</head>
<body>
<h1><?php echo $h1; ?></h1>
</body>
</html>
<?php } elseif ($template === 4) {
?><!doctype html><html lang="en"><head><meta charset="utf-8"><title><?php echo $title; ?></title><meta name="robots" content="noindex, nofollow"></head><body><h1><?php echo $h1; ?></h1></body></html>
<?php } else {
?><!doctype html>
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<meta charset="utf-8">
<title><?php echo $title; ?></title>
</head>
<body>
<h1><?php echo $h1; ?></h1>
</body>
</html>
<?php } ?>
