|
Post by Old Shendemiar on Feb 25, 2004 15:41:02 GMT
I would like to have a fancy members online display like in MU site, but i only use sessions.
Anyone have any nice ideas about how to do it.
|
|
|
Post by sparrowhawk on Feb 25, 2004 15:49:24 GMT
I'm not sure that you can with sessions (but someone may prove me wrong!).
Any reason why you don't want to do it via a MySQL table? I could send you the scripts (very simple)
|
|
|
Post by Old Shendemiar on Feb 25, 2004 15:51:39 GMT
I'm not sure that you can with sessions (but someone may prove me wrong!). Any reason why you don't want to do it via a MySQL table? I could send you the scripts (very simple) Cant i examie the files in sessions folder? I could do it by mysql, but how the database is updated when people dont log out, just close their browser?
|
|
|
Post by sparrowhawk on Feb 25, 2004 16:02:21 GMT
The way that my script works is that whenever someone access a page, the script is run. It does the following:
- deletes any records where the timestamp is older than a preset time
- Checks IP address of user. Creates new record with IP address and timestamp (or replaces existing one if IP address match found)
- If the user's session variable holding their ID exists, it enters it into a foreign key field in the record (actually part of previous step)
Then loops through to display number of guests (records with no foreign key set) and members are online
|
|
|
Post by Old Shendemiar on Feb 25, 2004 16:08:03 GMT
I see now how it could be done, but isnt that a bit much of load (each pagehit causes script to run and cause "lots of" mysql access?) I think i'll try first if i can do it by examinig sessions folder, but your way is my backup-plan
|
|
|
Post by sparrowhawk on Feb 25, 2004 16:09:57 GMT
Let me know if you succeed
|
|
|
Post by Old Shendemiar on Feb 25, 2004 17:27:54 GMT
Let me know if you succeed There are lots of files at the session folder on my host... Having bit trouble identifying which ones i can read.
|
|
|
Post by Old Shendemiar on Feb 25, 2004 17:43:26 GMT
I now have it at state where i have listed the names of those session files that are my own...
|
|
|
Post by Old Shendemiar on Feb 25, 2004 18:38:26 GMT
It kinda works now, but the old sessionfiles interfere... Why does php keep them?
How can i make session files disappear faster?
|
|
|
Post by Old Shendemiar on Feb 25, 2004 18:41:27 GMT
Feature working on "home"
|
|
|
Post by Old Shendemiar on Feb 25, 2004 20:31:23 GMT
I need to do it your way... i guess.
It's not that much traffic, if i only put the viewer on one page, and it's only recalculated when someone checks just that page!
|
|
|
Post by Old Shendemiar on Feb 26, 2004 2:54:59 GMT
Done, your way!
|
|
|
Post by sparrowhawk on Feb 26, 2004 8:15:06 GMT
Well, not really *my* way - I think that it's the way all such counters work. Glad to hear that it's working though
|
|