mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-11-16 05:11:55 -05:00
32 lines
640 B
PHP
32 lines
640 B
PHP
|
<?php
|
||
|
require 'Utils/Config.class.php';
|
||
|
$Config = new Config();
|
||
|
|
||
|
|
||
|
$datas = array();
|
||
|
|
||
|
if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk \'{print $1","$3","$4" "$5" "$6" "$7" "$8}\'', $users)))
|
||
|
{
|
||
|
$datas[] = array(
|
||
|
'user' => 'N.A',
|
||
|
'host' => 'N.A',
|
||
|
'date' => 'N.A',
|
||
|
);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$max = $Config->get('last_login:max');
|
||
|
|
||
|
for ($i = 1; $i < count($users) && $i <= $max; $i++)
|
||
|
{
|
||
|
list($user, $host, $date) = explode(',', $users[$i]);
|
||
|
|
||
|
$datas[] = array(
|
||
|
'user' => $user,
|
||
|
'host' => $host,
|
||
|
'date' => $date,
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo json_encode($datas);
|