You can prepare .lp file with such script:
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:
<?
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)
?>