adam84 Posted August 8, 2008 Share Posted August 8, 2008 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 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 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. Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 8, 2008 Author Share Posted August 8, 2008 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? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 I think it was something like 5%. But you should provide some graceful degradation. Anyway, regardless of Javascript being on, that's the method I'd use. Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 8, 2008 Author Share Posted August 8, 2008 Alrighty, thanks for the help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.