fwdkr.co/index.php

75 lines
1.8 KiB
PHP
Raw Normal View History

2021-03-18 18:05:49 +01:00
<?php
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
2021-03-22 20:17:58 +01:00
if ($path == "/admin") {
$_SERVER["PHP_SELF"] = $path;
include("phpliteadmin.php");
exit();
}
2021-03-18 18:05:49 +01:00
$db = new SQLite3(".links.db", SQLITE3_OPEN_READWRITE);
$stmt = $db->prepare("SELECT * FROM links WHERE path = :path;");
$stmt->bindValue(":path", $path);
$result = $stmt->execute()->fetchArray(SQLITE3_ASSOC);
2021-03-19 21:29:40 +01:00
$stmt = $db->prepare("UPDATE links SET visits = visits + 1, last_visit = CURRENT_TIMESTAMP WHERE path = :path;");
2021-03-18 18:05:49 +01:00
$stmt->bindValue(":path", $path);
$stmt->execute();
$db->close();
if ($result) {
$target = $result["target"];
header("Location: {$target}");
exit();
}
?>
2021-03-18 18:05:49 +01:00
<!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;
}
#wrapper {
margin: auto;
padding-top: 50px;
2021-03-19 20:59:53 +01:00
width: 50%;
max-width: 800px;
min-width: 400px;
}
</style>
</head>
<body>
<div id="wrapper">
<h1><a href="https://fwdekker.com/">FWDekker</a></h1>
<?php
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 />
2021-03-19 20:59:53 +01:00
Whenever you see a "fwdkr.co" link, you can trust that it will always take you to a website affiliated with
FWDekker.
</div>
</body>