06.05.2022, 08:26
Via .lp file:
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/apps/css/bootstrap.css">
</head>
<body>
<table class="table table-striped">
<tr>
<th>Date/time</th>
<th>Login</th>
<th>Name</th>
<th>IP</th>
</tr>
<?
require('apps')
items = db:getall([[
SELECT user_logs.*, users.name
FROM user_logs
JOIN users ON user_logs.login=users.login
ORDER BY user_logs.id DESC
LIMIT 50
]])
for _, item in ipairs(items) do
cls = toboolean(item.failed) and 'danger' or 'success'
datetime = os.date('%Y.%m.%d %H:%M:%S', item.created)
?>
<tr class="<?=cls?>">
<td><?=datetime?></td>
<td><?=escape(item.login)?></td>
<td><?=escape(item.name)?></td>
<td><?=escape(item.ip)?></td>
</tr>
<? end ?>
</table>
</body>
</html>