1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linuxdash_ynh.git synced 2024-09-03 19:36:07 +02:00
linuxdash_ynh/sources/sh/online.php

17 lines
367 B
PHP
Raw Normal View History

2014-06-02 13:38:03 +02:00
<?php
// change username column length for w command
putenv("PROCPS_USERLEN=20");
exec(
'PROCPS_FROMLEN=40 /usr/bin/w -h |' .
' /usr/bin/awk \'{print $1","$3","$4","$5}\'',
$users
);
$result = array();
foreach ($users as $user) {
$result[] = explode(",", $user);
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($result);