use symlink of ring/index.php

This commit is contained in:
Ben Harris 2021-01-16 18:02:34 -05:00
parent d6057694f1
commit be2f506a9a
3 changed files with 5 additions and 83 deletions

View File

@ -43,7 +43,7 @@ Or by sending a small donation:
$base_url = 'counter/';
// Default image style (font)
$default_style = 'cntdwn';
$default_style = 'led';
// Default counter image extension
$default_ext = 'gif';

View File

@ -91,9 +91,9 @@
<!-- tilde.team ring fragment-->
<div id="newring">
<center>
[<a href="https://tilde.team/ring/?action=prev&me=ben">previous page</a>]
[<a href="https://tilde.team/ring/?action=random&me=ben">random page</a>]
[<a href="https://tilde.team/ring/?action=next&me=ben">next page</a>]
[<a href="https://tilde.team/ring/?action=prev&me=ben">previous</a>]
[<a href="https://tilde.team/ring/?action=random&me=ben">random</a>]
[<a href="https://tilde.team/ring/?action=next&me=ben">next</a>]
<br>
<a href="https://tilde.team/ring/">how to join this webring</a>
</center>

View File

@ -1,79 +0,0 @@
<?php
$action = $_GET["action"] ?? "index";
$users = [];
foreach (glob("/home/*/.ring") as $path)
$users[] = basename(dirname($path));
if ($action !== "index") {
// handle webring redirects
$me = $_GET["me"] ?? "";
$i = array_search($me, $users) ?? 0;
switch ($action) {
case "random":
$notme = array_diff($users, [$me]);
$user = $notme[array_rand($notme)];
break;
case "next":
$user = $users[$i + 1] ?? reset($users);
break;
case "prev":
$user = $users[$i - 1] ?? end($users);
break;
default:
die("invalid action");
}
header("Location: https://tilde.team/~$user/");
die();
}
else {
// keep this as a string so we can escape it easily with htmlspecialchars()
$snippet = '<!-- Begin Tilde.Team Ring Fragment-->
<div id="newring">
<center>
[<a href="https://tilde.team/~ben/ring/?action=prev&me=USERNAME">previous</a>]
[<a href="https://tilde.team/~ben/ring/?action=random&me=USERNAME">random</a>]
[<a href="https://tilde.team/~ben/ring/?action=next&me=USERNAME">next</a>]
<br>
<a href="https://tilde.team/~ben/ring/">how to join this webring</a>
</center>
</div>';
?>
<!DOCTYPE html>
<html>
<head>
<title>webring - how to join</title>
<style><?php include "../gruvbox/gruvbox.min.css"; ?></style>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body id="top">
<main>
<h1>how to join the webring</h1>
<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>
<pre><?=htmlspecialchars($snippet)?></pre>
<p>you may edit the code however you want. it should work as long as the URLs are kept in place and have your user in them.</p>
<p>then create a .ring file in your ~ to be added in the webring:</p>
<pre>$ touch ~/.ring</pre>
<h3>explore webring</h3>
<ul>
<?php foreach ($users as $user): ?>
<li><a href="https://tilde.team/~<?=$user?>/">~<?=$user?></a></li>
<?php endforeach; ?>
</ul>
<p>see webring source <a href="index.php.txt">here</a></p>
<p>it will probably work if you copy it to your own <code>~/public_html</code></p>
</main>
</body>
</html>
<?php }

1
ring/index.php Symbolic link
View File

@ -0,0 +1 @@
/var/www/tilde.team/ring/index.php