Jump to content

ONLINE STATUS


pranshu82202

Recommended Posts

Phone them up and ask them?

 

Seriously: log the IP address, and time they last clicked a link. (to save DB space, prob best as a flat file system unless you got a large database capacity).  Then you can write a script to show when they last clicked a link.  with a time limit of 5 minutes per click, that should be a reasonable indication of when they're online, and what page they're on.

Link to comment
Share on other sites

You can't "check" their status. You can update the last time they accessed your site. Just add a function that will run on every page load to update a "last_access" timestamp for users whenever they load a page. Then, determine who is "online" based upon that timestamp, by choosing an appropriate time period: e.g. any users who's "last_access" time is within the last 10 minutes (or whatever period you want to use).

 

log the IP address, and time they last clicked a link. (to save DB space, prob best as a flat file system unless you got a large database capacity).

 

A flat file, seriously? How does a flat file save space over a database? Plus, since this will be updated every time a users access a page and when you need to get the data there is a huge possibility for file corruption.

Link to comment
Share on other sites

you are not getting me guyzz...

 

i am saying that if my website is opened in any users X browser (but not doing anything on it from several hour) and user Y want to send a PM to user X only if Y knows that X can instanty reply to it...... then how would user Y came to know that user X is online.

 

I understand perfectly what you want to do, and I also understand perfectly the reasons it doesn't work like that. Aside from setting up some elaborate, resource-wasting system using keepalive messages with JS/AJAX, the best you can do is log the time of the last activity of the user, and if it's been more than a predetermined amount of time since they last did anything, consider them inactive/unreachable/deceased/drowned/whatever. Just like mjdamato and flappy_warbucks said.

Link to comment
Share on other sites

but what if the user is sleeping and he is online (means the website is open for an hour or two)....

 

you are not getting me guyzz...

 

As others have stated, youzz are the one not getting it. If you followed the advice given and a user left their browser open to your site (with no activity) for two hours then they would not be seen as "online" since it would have been more than 15 minutes (or whatever period you set) since their last activity.

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.