2014-06-18 04:11:11 -04:00
|
|
|
<?php
|
|
|
|
require 'Utils/Config.class.php';
|
|
|
|
$Config = new Config();
|
|
|
|
|
|
|
|
|
|
|
|
$datas = array();
|
|
|
|
|
2015-01-16 12:14:07 -05:00
|
|
|
if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
|
2014-06-18 04:11:11 -04:00
|
|
|
{
|
|
|
|
$datas[] = array(
|
|
|
|
'user' => 'N.A',
|
|
|
|
'date' => 'N.A',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$max = $Config->get('last_login:max');
|
|
|
|
|
|
|
|
for ($i = 1; $i < count($users) && $i <= $max; $i++)
|
|
|
|
{
|
2015-01-16 12:14:07 -05:00
|
|
|
list($user, $date) = explode(';', $users[$i]);
|
2014-06-18 04:11:11 -04:00
|
|
|
|
|
|
|
$datas[] = array(
|
|
|
|
'user' => $user,
|
|
|
|
'date' => $date,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($datas);
|