Jump to content

users logged in based on session


DrTrans

Recommended Posts

You'd have too make it so in the database there's a field that indicates if the user is online or not. It would be like: online = true when they sign in, and online = false when they sign out or the session expires. That's the only way todo it because sessions are local. Well there are other ways, but this is the most practical.

 

-Zack

How would you know when their session expires (if they close out of your site)?

Obviously you can run a query in the event of a login/logout, but how would you know if they are logged in based on if they exit out of your site?

 

I'm thinking you can just perform scheduled queries, saying "If the user hasn't visited a new page in the past hour, mark them as offline" or something... is that the way to go?

I'm thinking you can just perform scheduled queries, saying "If the user hasn't visited a new page in the past hour, mark them as offline" or something... is that the way to go?

 

Thats pretty much how its done. You update a timestamp on each request, and also execute another query the deletes any user with a timestamp older than say 10 minutes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.