Right now I write to my database when a User Logs In or Logs Out. I update "logged_in" to "0" or "1" and "last_activity" gets NOW().
To back up a minute, what I am doing is this...
My website is full of Articles. Beneath each Article can be Comments. Next to each Comment, is the Poster's Username, Online Status, Photo, Location, and Comment.
I want the Poster's Online Status to entice Readers to post a Comment. (The logic being that if people think/see that others are online and Commenting, then they might be more inclined to do the same!!)
- If a Poster logs IN or OUT then their Online Status is updated
- If a Reader goes to an Article/Comments page, then the Reader will see a "snap-shot" of Posters who were On/Offline at that moment (sorta)
I am trying to add code that will update the Online Status every time a Poster navigates to another page.