fwdkr.co/dist/index.php

108 lines
3.3 KiB
PHP
Raw Normal View History

2021-03-18 18:05:49 +01:00
<?php
2021-03-22 21:13:50 +01:00
include_once("links.php");
include_once("goatcounter.php");
2021-03-22 21:13:50 +01:00
2021-03-18 18:05:49 +01:00
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
2021-03-22 22:25:07 +01:00
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;
2021-03-22 20:17:58 +01:00
}
$error = false;
$target = null;
$needs_confirmation = false;
try {
2021-03-22 21:13:50 +01:00
$links = new Links(".links.db", "links.sql");
list($target, $needs_confirmation) = $links->getTarget($path);
} catch (Exception $exception) {
$error = true;
2021-03-22 20:34:38 +01:00
}
2021-03-18 18:05:49 +01:00
if ($target != null && !$needs_confirmation) {
header("Location: $target");
2021-03-18 18:05:49 +01:00
exit();
}
?>
2021-03-18 18:05:49 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
2021-04-21 15:35:26 +02:00
<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" />
2021-04-21 15:35:26 +02:00
<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" />
2021-04-21 15:35:26 +02:00
<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>