blob: 4596e448b4092d690708ea340937c224be8f7b51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
require '../autoload.php';
$Config = new Config();
$datas = array();
if ($Config->get('last_login:enable'))
{
if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
{
$datas[] = array(
'user' => 'N.A',
'date' => 'N.A',
);
}
else
{
$max = $Config->get('last_login:max');
for ($i = 1; $i < count($users) && $i <= $max; $i++)
{
list($user, $date) = explode(';', $users[$i]);
$datas[] = array(
'user' => $user,
'date' => $date,
);
}
}
}
echo json_encode($datas);
|