Tobias Weik
|
Posted: 08/19/2003, 10:41 PM |
|
Hi,
does anyone have an idea how to get information about the current (and
active!) logged in users?
I created two tables for these informations:
- "current_users_online"
- "login_history"
I modified the CCLoginUser to insert a record (user_id, IP,
session-name, datetime, action) to both tables when the user gets logged in.
I also modified the CCLogoutUser to insert another record to the
"login_history" when the user gets logged out and to delete the record
from "current_users_online" with the same session-name to clear this
table...
Since most of my users donīt logout, my table keeps all these old values
- so I modified the CCLoginUser to update the records instead of
inserting a new one, if the user_id is the same and the record already
exists. (I also thought of cleaning the "current_users_online" table
every night, but since my users login from all over the word, this isnīt
such a good idea ;)
My main problem is: I am not able to see, who _really_ is current
online, cause I donīt have any "still-alive"-information...
I know that this is a wellknown problem for webbased applications, but
mayby someone has an idea? I am using CCS 1.07 / 2.1 for PHP4/templates
and MySQL4.
TIA - Tobias
|
|
|
DonB
|
Posted: 08/20/2003, 5:58 AM |
|
Seems like you'd have to do something like put a timestamp in the "user"
table and update the timestamp some way (like on a page-load). Then the
"connected" count would be approximated by the number of user records with
timestamps within whatever threshold you deem adequate.
But this certainly increases the database load.
ASP has an "application" variable, shared by all user sessions. I'd do this
sort of thing with an "application" array instead of hitting the database.
I don't know if PHP has something similar. Of course, there is a downside
here has well, as the array could become very large if your site might host
1000s of user sessions simultaneously.
You might just want to dissect one of the PHP forums packages to see what
they are doing, since this shows up frequently in them.
--
DonB
http://www.gotodon.com/ccbth
|
|
|
Tobias Weik
|
Posted: 08/21/2003, 1:10 PM |
|
DonB schrieb:
> You might just want to dissect one of the PHP forums packages to see what
> they are doing, since this shows up frequently in them.
Hi Don,
thanks for the hint, I will take a look at them...
Regards, Tobias
|
|
|
|