title: auto log off with php and mysql
body: <p>I am trying to make a chat room to my web page. and I want my users to know if the person they are trying to reach is afk/online/offline. i have looked around and found an answer on how to auto log out php sessions after a certain time. then you would have to add a timestamp when logged in an check if the time has passed the log out time if not you will have to update the time. so for my chat room i figured that I should add a time stamp when they logged on to the site in mysql. but then I would have to update this on every page. then the chat room would get all online users and check if the time stamp is less than 5 minutes ago. to avoid having the page use a long time loading the script i wanted to add this function in php at the bottom off the page where it update the time_stamp in the database every time the page is loaded. </p>
  
  <p>so before I go on making this code I was wondering if this is a smart solution or if there is an easier way. I know i could make a javascript on the user and check if it should change the status but this would not work if the user has disabled javascript on my page.</p>
  
  <p>so should I make my chat room user status like this or is there another better/smarter  solution?</p>