This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Usernames in log
#6
You can prepare .lp file with such script:
Code:
<?
now=os.microtime()
last_login = db:getall('SELECT * FROM user_logs ORDER BY created DESC LIMIT 1')
user = last_login[1].login
print(user)
?>  

and you can use it from js.

As in this thread:
http://forum.logicmachine.net/showthread...le#pid3118

Unfortunately there is at least 1 possible problem when 2 users login in the same time(if more than 1 second it should be ok).

Maybe this is not a perfect solution but at this moment can be helpful. You can also improve it.

A minute ago I've found some solution from Erwin and now it is possible to recognize very precisely who is who.

So .lp file should looks like here:
Code:
<?
require('genohm-scada')
require('dbenv')
db = dbenv:new()

ip = ngx.var.remote_addr
user = db:getall("SELECT login FROM user_logs WHERE ip='" .. ip .. "' ORDER BY created DESC LIMIT 1")
print(user[1].login)
?>
Reply


Messages In This Thread
Usernames in log - by Thomas - 07.03.2017, 12:14
RE: Usernames in log - by admin - 07.03.2017, 12:53
RE: Usernames in log - by buuuudzik - 07.03.2017, 13:26
RE: Usernames in log - by cekca - 20.04.2017, 12:06
RE: Usernames in log - by Thomas - 08.03.2017, 19:18
RE: Usernames in log - by buuuudzik - 20.04.2017, 15:20
RE: Usernames in log - by admin - 20.04.2017, 15:37
RE: Usernames in log - by buuuudzik - 20.04.2017, 16:16

Forum Jump: