|
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.
|
- Witango-Talk: Who's online? Peter Ternstrom
- RE: Witango-Talk: Who's online? David Shelley
- RE: Witango-Talk: Who's online? John Hollister
