Fix arya's html and indentation, add to users.php

Signed-off-by: Aleksandar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2022-06-27 03:54:36 -04:00
parent 75603ba079
commit 628719aabe
Signed by untrusted user: cobra
GPG Key ID: 4FD8F812083FF6F9
3 changed files with 28 additions and 25 deletions

View File

@ -3,12 +3,12 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/style.css">
<title>What is ~vern?</title>
<title>What is ~vern? | ~vern</title>
</head>
<body>
<!--#include file="nav" -->
<h1> What is ~vern? </h1>
Vern is a non-commercial, freesoftware-focused shared gnu/linux system that offers many services. Our services are for the community, by the community (no corporate backing). We try to jeep the data stored extremely low and do not sell your data.
<h1> What is ~vern? </h1>
<p>Vern is a non-commercial, free software-focused shared GNU/Linux system that offers many services. Our services are for the community, by the community (no corporate backing). We try to keep the data stored extremely low and do not sell your data to anybody.</p>
<!--#include file="footer" -->
</body>
</html>

View File

@ -25,17 +25,12 @@
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (!empty($_POST['username'])) {
if (preg_match($username_re, $_POST['username']) === 1) {
$ret = 0;
exec("bash -c 'id " . $_POST['username'] . " &> /dev/null; printf %d $?'", $blank, $ret);
if ($ret == 0) {
if (preg_match('/^' . $username . ':x:\d+:\d+:[\w\d\s,@()]*:[\w\d\s\/]*:[\d\s\w\/]*/m', file_get_contents('/sshfs/etc/passwd')) !== 1) {
if (!file_exists("/var/tmp/register/" . sanitize($_POST['username'])))
$username = sanitize($_POST['username']);
else $username_err = "A request for the username " . $_POST['username'] . " exists already. Try again later or choose a different username.";
}
else $username_err = "Username is already in use";
unset($ret);
} else {
$username_err = "Invalid username. Username must be a valid GNU/Linux username (match $username_re)";
}
@ -66,7 +61,6 @@
if (!empty($_POST['ssh'])) {
$ret = shell_exec("bash -c 'ssh-keygen -lf - <<< " . escapeshellarg($_POST['ssh']) . " &> /dev/null ; printf %d $?'");
if ($ret == 0) {
$ssh = $_POST['ssh'];
} else {
@ -177,6 +171,8 @@
// if ($use_nextcloud) $contents .= "~/bin/mknuser " . escapeshellarg($username) . "\n";
$contents .= "s-nail -vr 'register@vern.cc' -c cobra@vern.cc -c neopenk@vern.cc -c aryak@vern.cc -s 'Your ~vern account has been created' -M text/plain " . escapeshellarg($email) . " < <(printf 'Hello %s,\\nYour membership request on ~vern has been accepted.\\nYou can now SSH into vern.cc using the public key(s) that you supplied to ~vern.\\n\\nThank you for being a part of ~vern!' " . escapeshellarg($username) . ")\n";
$contents .= "rm -f $0\n";
$contents .= "exit\n\n\n";
$contents .= $reason;
$filename = "/var/tmp/register/" . $username;
$handle = fopen($filename, "w+");

View File

@ -6,24 +6,31 @@
<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>).</p>
<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>). 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
$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';
echo ' <li online="' . $online . '">' . $subdir . "</li>\n";
}
}
closedir($handle);
?>
<?php echo $list; ?>
</ul>
<!--#include file="footer" -->
</body>