2022-06-22 01:29:21 +00:00
<! DOCTYPE html >
< html lang = " en " >
< head >
< meta charset = " UTF-8 " >
2022-09-30 11:11:42 +00:00
< meta name = " viewport " content = " width=device-width " >
2022-06-22 01:29:21 +00:00
< link rel = " stylesheet " href = " /style.css " >
2022-06-23 18:02:32 +00:00
< title > Users | ~ vern </ title >
2022-06-22 01:29:21 +00:00
</ head >
< body >
2022-06-27 07:54:36 +00:00
< ? php
$total = $on = 0 ;
$list = '' ;
2022-08-10 20:04:46 +00:00
$onlist = array ();
2022-06-27 07:54:36 +00:00
$users = explode ( ' ' , shell_exec ( 'users /sshfs/var/run/utmp' ));
$handle = opendir ( '/sshfs/home' );
while (( $subdir = readdir ( $handle )) !== false ) {
2022-06-28 11:04:12 +00:00
$online = '<b><span class=' ;
2022-06-27 07:54:36 +00:00
if ( $subdir != '.' && $subdir != '..' ) {
2022-06-29 12:01:42 +00:00
$is_online = false ;
2022-06-27 07:54:36 +00:00
foreach ( $users as $val )
2022-08-10 20:04:46 +00:00
if ( trim ( $val ) == $subdir && ! in_array ( $subdir , $onlist )) {
2022-06-28 11:04:12 +00:00
$online .= 'green' ;
2022-06-29 12:01:42 +00:00
$is_online = true ;
2022-06-27 07:54:36 +00:00
$on ++ ;
2022-08-10 20:04:46 +00:00
array_push ( $onlist , $subdir );
2022-06-29 12:01:42 +00:00
}
if ( ! $is_online ) $online .= 'red' ;
2022-06-28 11:04:12 +00:00
$online .= '>•</span></b> ' ;
$list .= ' <li>' . $online ;
2022-06-28 19:43:24 +00:00
$ph_index = '/sshfs/home/' . $subdir . '/public_html/index.' ;
if ( is_readable ( $ph_index . 'html' ) ||
is_readable ( $ph_index . 'php' ) ||
is_readable ( $ph_index . 'cgi' ) ||
is_readable ( $ph_index . 'py' ) ||
is_readable ( $ph_index . 'sh' ) ||
is_readable ( $ph_index . 'pl' ) ||
is_readable ( $ph_index . 'lua' )) // There must be a better way to do this
2022-06-27 11:19:52 +00:00
$list .= " <a href='// $subdir .vern.cc'> $subdir </a> " ;
else $list .= $subdir ;
$list .= " </li> \n " ;
2022-06-27 07:54:36 +00:00
$total ++ ;
}
}
closedir ( $handle );
?>
2022-09-17 17:50:09 +00:00
<!-- #include file="nav.html" -->
2022-06-22 18:01:36 +00:00
< div class = h >< h1 id = users > Users </ h1 > < a aria - hidden = true href = #users>#users</a></div>
2022-06-28 11:04:12 +00:00
< 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 joining . There are currently a total of < ? php echo $total ; ?> members, <?php echo $on; ?> of which <?php echo $on !== 1 ? are : is ?> online.</p>
< ol >
2022-06-27 07:54:36 +00:00
< ? php echo $list ; ?>
2022-06-28 11:04:12 +00:00
</ ol >
2022-09-17 17:50:09 +00:00
<!-- #include file="footer.html" -->
2022-06-22 01:29:21 +00:00
</ body >
</ html >