show error if me= is set and incorrect

This commit is contained in:
Ben Harris 2021-01-13 13:35:35 -05:00
parent 9dafe487bf
commit 399508d366
1 changed files with 8 additions and 1 deletions

View File

@ -6,7 +6,11 @@ $users = array_map(function ($f) { return basename(dirname($f)); }, glob("/home/
if ($action !== "index") {
// handle webring redirects
$me = $_GET["me"] ?? "";
$i = array_search($me, $users) ?? 0;
if (!in_array($me, $users) && $action != "random") {
header("Location: https://tilde.team/ring/?error");
die();
}
$i = array_search($me, $users);
switch ($action) {
case "random":
@ -50,6 +54,9 @@ else {
include __DIR__ . '/../header.php';
?>
<h1>how to join the webring</h1>
<?php if (isset($_GET["error"])): ?>
<div class="alert alert-danger" role="alert"><strong>ERROR</strong> please be sure that me=USERNAME is set to your user and have created a <code>~/.ring</code> file.</div>
<?php endif; ?>
<p>this webring can be joined by any user on tilde.team.</p>
<p>first, add the following links to your page, replacing USERNAME by your username (no ~):</p>