Added stuff.
This commit is contained in:
34
index.php
34
index.php
@@ -1 +1,33 @@
|
||||
<?php echo "hi" ?>
|
||||
<?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>
|
||||
|
||||
Reference in New Issue
Block a user