Files
ringularity/index.php
2026-03-10 14:12:55 -04:00

34 lines
609 B
PHP

<?php
$sites = file("sites.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$current = $_GET['site'] ?? '';
if (!$current) {
echo "No site specified.";
exit;
}
$index = array_search($current, $sites);
if ($index === false) {
echo "Site not in ring.";
exit;
}
$total = count($sites);
$prevIndex = ($index - 1 + $total) % $total;
$nextIndex = ($index + 1) % $total;
$prev = $sites[$prevIndex];
$next = $sites[$nextIndex];
?>
<div class="webring">
<a href="<?= htmlspecialchars($prev) ?>">← Previous</a>
|
<a href="<?= htmlspecialchars($next) ?>">Next →</a>
</div>