Add users.php

Signed-off-by: Aleksandar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2022-06-21 21:29:21 -04:00
parent 30a807f20c
commit 5e45a915f6
Signed by untrusted user: cobra
GPG Key ID: 4FD8F812083FF6F9
2 changed files with 55 additions and 4 deletions

View File

@ -1,6 +1,6 @@
body {
font-family: 'Fira Code';
src: url("/woff/FiraCode-Regular.woff") format("woff");
font-family:'Fira Code';
src:url("/woff/FiraCode-Regular.woff") format("woff");
margin:20px auto;
max-width:800px;
line-height:1.5em;
@ -67,11 +67,31 @@ pre {
color:#ff6c6b;
}
.green {
color:#98be65;
}
input[type=submit] {
padding:5px 15px;
background:#51afef;
border:0 none;
-webkit-border-radius: 10px;
border-radius: 10px;
-webkit-border-radius:10px;
border-radius:10px;
}
ul[userlist] {
list-style:none;
}
ul[userlist] li[online]::before {
content:"\2022";
color:#ff6c6b;
font-weight:bold;
display:inline-block;
width:1.0em;
margin-left:-1.0em;
}
ul[userlist] li[online$=true]::before {
color:#98be65;
}

31
users.php Normal file
View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/style.css">
<title>~vern users</title>
</head>
<body>
<!--#include file="nav" -->
<div class=h><h1 id=users>users</h1> <a aria-hidden=true href=#admins>#admins</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>).</p>
<ul userlist>
<?php
$users = explode(' ', shell_exec('users /sshfs/var/run/utmp'));
$handle = opendir('/sshfs/home');
while (($subdir = readdir($handle)) !== false) {
if ($subdir != '.' && $subdir != '..') {
foreach ($users as $val) {
$online='false';
if (trim($val) == $subdir) $online='true';
}
echo '<li online="' . $online . '">' . $subdir . "</li>\n";
}
}
closedir($handle);
?>
</ul>
<!--#include file="footer" -->
</body>
</html>