website/users.php

38 lines
1.1 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/style.css">
<title>Users | ~vern</title>
</head>
<body>
<?php
$total = $on = 0;
$list = '';
$users = explode(' ', shell_exec('users /sshfs/var/run/utmp'));
$handle = opendir('/sshfs/home');
while (($subdir = readdir($handle)) !== false) {
if ($subdir != '.' && $subdir != '..') {
$online='false';
foreach ($users as $val)
if (trim($val) == $subdir) {
$online='true';
$on++;
}
$list .= ' <li online="' . $online . '">' . $subdir . "</li>\n";
$total++;
}
}
closedir($handle);
?>
<!--#include file="nav" -->
<div class=h><h1 id=users>Users</h1> <a aria-hidden=true href=#users>#users</a></div>
<p>This is a list of all ~vern users, and whether they are online (<b><span class=green>•</span></b>) or not (<b><span class=red>•</span></b>) in order of least to greatest UID. There are currently a total of <?php echo $total; ?> members, <?php echo $on; ?> of which <?php echo $on !== 1 ? are : is ?> online.</p>
<ul userlist>
<?php echo $list; ?>
</ul>
<!--#include file="footer" -->
</body>
</html>