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/users.php
2014-06-02 13:38:03 +02:00

22 lines
439 B
PHP

<?php
exec(
'/usr/bin/awk -F: \'{ if ($3<=499) print "system,"$1","$6;' .
' else print "user,"$1","$6; }\' < /etc/passwd',
$result
);
header('Content-Type: application/json; charset=UTF-8');
echo "[";
$x = 0;
$max = count($result)-1;
foreach ($result as $a) {
$x++;
$line = explode(',', $a);
if ($line[1][0] == '#') {
continue;
}
echo json_encode($line);
echo ($x-1==$max)?'':',';
}
echo ']';