as this is something exactly i was doing for the past few days i can help
as i figured, the best and the easiest way to achieve this is using Jscript, where a periodical updator will update the the availability of the user
this is okay for ma chat script, but i dunno whether its okay with you, but i assure that it's mostly accurate than the previous method i used: of keeping the track of the user using a cookie and the work done by the user

but sorry im in a kindda hurry
so basically the logic is,
when the user sign in-> you take him to a new page ex:homepage
then the user is added to the online table
and in the header of the site, you put the update code, or a jS AJAX request every 30sec. to update the time() of the database

and peridically, add another check, mostly a AJAX request to delete the records which have the time() filed updated more than before 1 minute

so that's it D
hope you understand, and the code is rather simpler and may be you can figure it out yourself
however ill write it seperatly later [i ave it with the core files of the chat scirpt so that it takes time to make it as standalone]
shabbir like this