fwdkr.co/index.php

112 lines
2.8 KiB
PHP

<?php
include_once("links.php");
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
if ($path == "/admin") {
$_SERVER["PHP_SELF"] = $path;
include("phpliteadmin.php");
exit();
}
$error = false;
$target = null;
try {
$links = new Links(".links.db", "links.sql");
$target = $links->getTarget($path);
$links->handleVisit($path);
} catch (Exception $exception) {
$error = true;
}
if ($target != null) {
header("Location: {$target}");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FWDekker</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style>
* {
font-family: "Roboto", sans-serif;
}
a:link, a:visited, a:hover, a:active {
color: black;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
main {
display: flex;
flex-direction: column;
margin: 0 auto;
width: 50%;
min-width: 400px;
min-height: 100%;
}
#contents {
flex: 1;
margin: 5rem 0;
}
footer {
color: #606c76;
margin-bottom: 3rem;
}
</style>
</head>
<body>
<main>
<section id="contents">
<h1><a href="https://fwdekker.com/">FWDekker</a></h1>
<?php
if ($error) {
?>
<b>Internal server error</b><br /><br />
Something went wrong internally, and you could not be redirected. Please try again later.<br /><br />
<br /><br />
<?php
} else if ($path != "/") {
?>
<b>Link not found</b><br /><br />
The short URL https://fwdkr.co<?= $path ?> could not be found.<br /><br />
<br /><br />
<?php
}
?>
<b>About fwdkr.co</b><br /><br />
You've arrived at this page because you typed or linked to "fwdkr.co", the URL shortcut for
<a href="https://fwdekker.com/">fwdekker.com</a>.<br /><br />
Whenever you see a "fwdkr.co" link, you can trust that it will always take you to a website affiliated with
FWDekker.
</section>
<footer>
Made by <a href="https://fwdekker.com/">Felix W. Dekker</a><span>.
Licensed under the
<a href="https://git.fwdekker.com/FWDekker/fwdkr.co/src/branch/master/LICENSE">MIT License</a>.
Source code available on </span><a href="https://git.fwdekker.com/FWDekker/fwdkr.co/">git</a>.
Consider reading the <a href="https://fwdekker.com/privacy/">privacy policy</a>.
<div style="float: right;">v1.0.7</div>
</footer>
</main>
</body>