Hi, is there a way to display the user access logs in a frame on a vis page.
Only want to show user accounts and exclude ADMIN logins
Only want to show user accounts and exclude ADMIN logins
User Access Log on Vis
|
Hi, is there a way to display the user access logs in a frame on a vis page.
Only want to show user accounts and exclude ADMIN logins
06.05.2022, 08:26
Via .lp file:
Code: 123456789101112131415161718192021222324252627282930313233343536373839 <!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>
06.05.2022, 13:43
(06.05.2022, 08:26)admin Wrote: Via .lp file:Many thanks for your help
07.05.2022, 18:22
It is the full code (:
08.05.2022, 15:47
(07.05.2022, 18:22)Erwin van der Zwart Wrote: It is the full code (: Aha Seems I miss how to use it ![]() should I have something like this at the beginning or its done in another way dst = '/www/user/accesslog.lp' io.writefile(dst, [[..... accesss log code.... ]])
Best Regards,
09.05.2022, 06:49
(This post was last modified: 09.05.2022, 06:50 by Erwin van der Zwart.)
Well this code is enabling you to automatically write it to a file on the FTP server, but you could have also just manually upload the code as a .lp file to the FTP server...
|
« Next Oldest | Next Newest »
|