Peter,
 
One way is to track active users in your database. Create a table called ActiveUsers with columns UserRef, UserName, LastHitTime. On every page you update a user record in the users record:
 
UPDATE ActiveUsers SET LastHitTime = <@currentTimestamp> WHERE UserRef = <@UserReference>
If <@numaffected> = 0 for the SQL above, then insert a record for that user.
 
When a user logs on, you update his record to set the UserName column or any other data you want to track about him.
 
Currently logged on users are found by
SELECT UserName FROM ActiveUsers
WHERE UserName IS NOT NULL
AND LastHitTime > currentTimeStamp - variableTimeout
 
This technique can be a bit cumbersome as it requires an extra database action on every page hit. If you application is structured to run everything through one main.taf file then you only have to put the extra code or callMethod in one place. If not you have to put it in every taf file.
 
Another technique we developed is to extract the data from the tango.log file. This doesn't add any overhead on each page hit, but requires a lot of extra processing when you check to see which users are active.
 
Which technique is better for you depends on your business requirements and what you need to accomplish.
 
Hope this helps.
 
Dave Shelley
Visit tango.ca for expert developer assistance, custom business applications or application audits.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Peter Ternstrom
Sent: Wednesday, November 13, 2002 2:55 AM
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: Who's online?

Hello everyone!
 
For a simple communtiy I've developed for a client (Ferrari Scandinavia), it would be nice to add a "who's online" function, that will show the users currently browsing the forum.
 
This task proves quite hard, the solutions ive come up with require quite a lot of server power, and a constantly updating frame in the browser. Has anyone here developed a who's online function? Grateful for all help!
 
/Peter, Stockholm (first snow today)

Reply via email to