<?php
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
	$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
	$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales);
	$clientLocales = explode(',', $clientLocales);
	$availableLocales = array('en', 'fr');
	foreach ($clientLocales as $clientLocale) {
	if (in_array($clientLocale, $availableLocales)) {
		$locale = $clientLocale;
		break;
	}
	}
}

if (isset($locale) AND $locale == "fr") {
#	echo file_get_contents("404.fr.html");
#else { ?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Not available over unsecure HTTP</title>
	</head>
	<body>
		<h1>Not available over unsecure HTTP</h1>
		<p>
	This server does not accept unsecure HTTP requests. <a href="<?php echo htmlspecialchars($_SERVER['QUERY_STRING']);

?>">Use HTTPS</a> instead.
		</p>
		<details open="">
			<summary>What happened?</summary>
			You made a request to the server using the unsecure HTTP protocol (<code>http://</code>). For privacy and security reasons, the server does not accept this, as unsecure HTTP connections can be watched and modified by any device on the way.
		</details>
		<details>
			<summary>How to solve this?</summary>
			You can tell your browser to use HTTPS by prefixing the URL with <code>https://</code>.
		</details>
		<small><code>HTTP 403</code></small>
	</body>
</html>

<?php } ?>
