108 lines
3.3 KiB
PHP
108 lines
3.3 KiB
PHP
<?php
|
|
include_once("links.php");
|
|
include_once("goatcounter.php");
|
|
|
|
|
|
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
|
switch ($path) {
|
|
case "/admin":
|
|
$_SERVER["PHP_SELF"] = $path;
|
|
include("phpliteadmin.php");
|
|
exit();
|
|
case "/favicon.ico":
|
|
header("Location: https://fwdekker.com/favicon.ico");
|
|
exit();
|
|
default:
|
|
goatcounter_record_hit($path);
|
|
break;
|
|
}
|
|
|
|
$error = false;
|
|
$target = null;
|
|
$needs_confirmation = false;
|
|
try {
|
|
$links = new Links(".links.db", "links.sql");
|
|
list($target, $needs_confirmation) = $links->getTarget($path);
|
|
} catch (Exception $exception) {
|
|
$error = true;
|
|
}
|
|
|
|
if ($target != null && !$needs_confirmation) {
|
|
header("Location: $target");
|
|
exit();
|
|
}
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="author" content="F.W. Dekker" />
|
|
<meta name="application-name" content="FWDekker URL Shortener" />
|
|
<meta name="description" content="FWDekker URL Shortener" />
|
|
<meta name="theme-color" content="#0033cc" />
|
|
|
|
<meta name="fwd:nav:target" content="#nav" />
|
|
<meta name="fwd:header:target" content="#header" />
|
|
<meta name="fwd:header:title" content="fwdkr.co" />
|
|
<meta name="fwd:footer:target" content="#footer" />
|
|
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/FWDekker/fwdkr.co/" />
|
|
<meta name="fwd:footer:version" content="v1.4.2" />
|
|
|
|
<title>fwdkr.co</title>
|
|
|
|
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
|
|
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/2.x.x/template.css" />
|
|
</head>
|
|
<body>
|
|
<main> <!-- Do not hide without JavaScript -->
|
|
<div id="nav"></div>
|
|
<div id="contents">
|
|
<div id="header"></div>
|
|
|
|
<section class="container">
|
|
<?php
|
|
if ($error) {
|
|
?>
|
|
<h3>Internal server error</h3>
|
|
<p>Something went wrong internally, and you could not be redirected. Please try again later.</p>
|
|
<?php
|
|
} else if ($needs_confirmation) {
|
|
?>
|
|
<h3>Confirm redirect</h3>
|
|
<p>This URL redirects to <b><?= $target ?></b>.</p>
|
|
|
|
<p><a href="<?= $target ?>">Click here to proceed</a></p>
|
|
<?php
|
|
} else {
|
|
if ($path != "/") {
|
|
?>
|
|
<h3>Link not found</h3>
|
|
<p>The short URL <b>https://fwdkr.co<?= $path ?></b> could not be found.</p>
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
<h3>About fwdkr.co</h3>
|
|
<p>
|
|
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>.
|
|
</p>
|
|
|
|
<p>
|
|
Whenever you see a "fwdkr.co" link, you can trust that it will always take you to a website
|
|
affiliated with FWDekker.
|
|
</p>
|
|
<?php
|
|
}
|
|
?>
|
|
</section>
|
|
</div>
|
|
<div id="footer"></div>
|
|
</main>
|
|
|
|
<script src="https://static.fwdekker.com/lib/template/2.x.x/template.js"></script>
|
|
</body>
|