feat: add active users and update user list style

This commit is contained in:
iodomi
2026-06-22 16:01:47 +02:00
parent 49beaa601a
commit a9dd0ab799
3 changed files with 96 additions and 10 deletions

View File

@@ -1,20 +1,45 @@
<?php
<?php
include 'header.php';
$activeUsers = json_decode(file_get_contents('/opt/html/online.json'), true);
?>
<h1>> Users </h1>
<article id="content">
Lista użytkowników i linki do ich blogów
Lista użytkowników obecnie aktywnych:
<div class="user-list">
<?php
if (!empty($activeUsers)) {
foreach ($activeUsers as $user) {
$username = htmlspecialchars($user);
echo "<a class=\"users\" href='/~$username'>$username</a>";
}
} else {
echo "...";
}
?>
</div>
<br>
Lista użytkowników i linki do ich blogów:
<ul>
<?php
$host=htmlspecialchars($_SERVER['SERVER_NAME']);
//$host="";
foreach (scandir("/home/") as $file) {
if (in_array($file, array('.', '..'))) continue;
echo "<li><a href=\"/~$file\">~$file</a></li>";
}
?>
<div class="user-list">
<?php
$host=htmlspecialchars($_SERVER['SERVER_NAME']);
//$host="";
foreach (scandir("/home/") as $file) {
if (in_array($file, array('.', '..'))) continue;
echo "<a href=\"/~$file\">$file</a>";
}
?>
</div>
</ul>
</article>