Is there a way I can piggy back sessions to know if the user is online?
I.e: use logs on, I set a $_SESSION variable, user times out- cookie Garbage collector update
One thing I would advise is to store this kind of information in memory with for example memcached or mysql heap or redis. Because otherwise the database will be hit a lot.