mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2026-08-14 23:53:40 -04:00
+ First commit (version 2.0)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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);
|
||||
Reference in New Issue
Block a user