whose is online?

Hi Folks,

I’ll try and put my problem as simply as possible:

I have a members only site. and on the site is a “who’s is online” page and it also tells you where on the site they are.

My pages are session controlled and set to 30 mins. So if members have no activity or forget to log out, their sessions ends after 30 mins and their name disappears after 30 mins from the “Who is online page”.

My problem/question is:

  1. If a member logs out through the log out button (and doesn’t just close the window without logging out properly) and the session is destroyed should their name disappear from the “who is online” page straight away?

  2. If i log in and out then log in again i don’t increment my hits counter which is on my “Site Stats” page. Would this be because the session is for 30 mins and it thinks i’m still logged in, thus not enabling me to re-enter another “hit”?

I hope i made that clear and someone can help.

I didn’t originate that part of the script and i just need to check it’s working properly or rather how it should do.

Thankyou,

soulman

hhmmm…? well i guess it’s not clear enough or no one can help?

Although I admit my knowledge on sessions is a bit rusty, I belive they work in the same was as cookies (but on the server side) in the sence that you must track the session using a mixture of a database and scripts.

A simple way of doing what you ask is to store that users IP address and session ID in a database, whenever a user revisits a page with the same session ID update the database and reset the “timeout” time (in your database).

To add to that you’ll need another little bit of code which will check to see which users (session ID’s) haven’t revisited a page within the “timeout” time then delete them from the database.

Sponsor our Newsletter | Privacy Policy | Terms of Service