2022-06-22 01:29:21 +00:00
<! DOCTYPE html >
2022-10-31 14:47:44 +00:00
<!--
This program is free software : you can redistribute it and / or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation , either version 3 of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU Affero General Public License for more details .
You should have received a copy of the GNU Affero General Public License along with this program . If not , see < https :// www . gnu . org / licenses />.
-->
2022-06-22 01:29:21 +00:00
< 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' ));
2022-10-25 12:50:56 +00:00
$subdirs = scandir ( '/vm' , SCANDIR_SORT_ASCENDING );
foreach ( $subdirs as $subdir ) {
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-10-25 12:54:32 +00:00
$list .= " <a href='// $_SERVER[HTTP_HOST] /~ $subdir /'> $subdir </a> " ;
2022-06-27 11:19:52 +00:00
else $list .= $subdir ;
2022-11-01 03:57:56 +00:00
$ph_index = '/sshfs/home/' . $subdir . '/public_gemini/index.' ;
if ( is_readable ( $ph_index . 'gmi' ) ||
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-11-01 04:15:19 +00:00
$list .= " <a href='//gp.vern.cc/gemini/vern.cc/~ $subdir /'>(gemini)</a> " ;
2022-11-01 03:59:49 +00:00
$ph_index = '/sshfs/home/' . $subdir . '/public_gopher/gopher' ;
2022-11-01 03:57:56 +00:00
if ( is_readable ( $ph_index . 'map' )) // There must be a better way to do this
2022-11-01 04:15:19 +00:00
$list .= " <a href='//gp.vern.cc/gopher/vern.cc/1/~ $subdir /'>(gopher)</a> " ;
2022-06-27 11:19:52 +00:00
$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-10-25 12:53: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 alphabetical order . There are currently a total of < ? php echo $total ; ?> members, <?php echo $on; ?> of which <?php echo $on !== 1 ? are : is ?> online.</p>
2022-06-28 11:04:12 +00:00
< 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 >