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 -~----------~----~----~----~------~----~------~--~---