Jump to content

[SOLVED] Tracking Online Status


adam84

Recommended Posts

When the user logs in, the members page get loaded, I then insert their ID and the time they logged in into a table.

 

The members page uses AJAX to load all the site's content, so the member's page doesn't ever get refreshed unless the user chooses to refresh the page.

 

If the user refreshes the page, I do a check to see if they are already in the table (already logged in). If they are in the table I skip the insert query else I do the insert query(initial load).

 

Then I added an AJAX function on the onUnload event in my <BODY> of the members page, that will remove the user from the 'online table'.

 

Is this the right way of doing this, or is there a better way?

 

Thanks

Link to comment
Share on other sites

Not really how I'd do it, especially because they may not have Javascript on.  I'd update their "last_activity" column in the users table on every page, and then when displaying who's online, just search for who had activity in the last 5 minutes.

Link to comment
Share on other sites

But since the core of my site consists of using AJAX which is just javascript, is an all AJAX site considered to be a poor choice of design? What pecentage of people do you think has javascript turned off?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.