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

15 lines
364 B
PHP
Executable file

<?php
exec(
'/usr/bin/lastlog --time 365 |' .
' /usr/bin/awk \'{print $1","$3","$4" "$5" "$6" "$7" "$8}\'',
$users
);
$result = array();
# ignore the first line of column names
for ($i = 1; $i < count($users); ++$i) {
$result[$i-1] = explode(",", $users[$i]);
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($result);