{{for user in db((db.online.last_visit>time.time()-dt) (db.online.user_id==db.auth_user.id).select():}} {{=user.auth_user.last_name}}<br /> {{pass}}
On Jun 15, 2:17 pm, pk <peter.kirch...@youngdesigners.de> wrote: > i need it like so (logic): > > Folgende User sind online:<br /><br /> > {{for onuser in db.auth_user:}} > {{if(URL(r=request,c='userstate',f='is_user_online(onuser)')):}} > {{=onuser.last_name}} > {{pass}} > {{pass}} > > On 15 Jun., 20:48, pk <peter.kirch...@youngdesigners.de> wrote: > > > oh i forget to ask, > > > and how can i now display on the html page, which user are online? > > thanks massimo for your time ;) > > > On 15 Jun., 20:24, pk <peter.kirch...@youngdesigners.de> wrote: > > > > thanks massimo ;) > > > > On 15 Jun., 20:07, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > Put this in your layout.html > > > > > <script language="Javascript" type="text/javascript"> > > > > jQuery(document).ready(function(){ > > > > setTimeout("keepalive('{{=URL > > > > (r=request,c='default',f='keepalive')}}')",2000);}); > > > > > </script> > > > > > This in your model > > > > > db.define_table('online',SQLField('user_id',db.auth_user),SQLField > > > > ('last_visit','integer')) > > > > > This in your default.py controller > > > > > @auth.requires_login() > > > > def keepalive(): > > > > import time > > > > if not db.online[auth.user.id]: > > > > db.online.insert(user_id=auth.user.id,last_visit=time.time()) > > > > else: > > > > db(db.online.user_id==auth.user.id).update(last_visit=time.time > > > > ()) > > > > > and use this function to check > > > > > def is_user_online(user_id): > > > > import time > > > > dt = 5000 > > > > return db(db.online.user_id==user_id) > > > > (db.online.last_visit>time.time()-dt.count()>0 > > > > > Massimo > > > > > On Jun 15, 12:57 pm, pk <peter.kirch...@youngdesigners.de> wrote: > > > > > > hi, > > > > > > is there a available command or function to check whether the user > > > > > (from auth.user) is online or not? > > > > > > thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---