Files
biblioteca-de-contos/index.php
2025-08-04 04:46:10 -03:00

46 lines
1.5 KiB
PHP

<!doctype html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/base.css" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="javascript/libs/vanila.js"></script>
<title>;-;</title>
</head>
<body>
<div id="menu">
<label>Logo</label>
<header>
<ul>
<li id="btn">
<a href="index.php"> Inicio </a>
</li>
<li id="btn">
<a href="index.php?pg=2"> Escrever Historia </a>
</li>
</ul>
</header>
</div>
<?php
set_error_handler(function ($severity, $message, $file, $line) {
throw new ErrorException($message, 0, $severity, $file, $line);
});
$page = filter_input(INPUT_GET, "pg", FILTER_VALIDATE_INT) ?: 1;
$comps = ["inicio.php", "escrever.php"];
try {
$file = "componentes/" . $comps[$page - 1];
if (!file_exists($file)) {
http_response_code(404);
die("<p>Error 404, arquivo não encontrado</p>");
}
} catch (Exception $e) {
$file = "componentes/inicio.php";
}
require_once $file;
?>
</body>
</html>