what i did before was the following:
store the username in a cookie (duh!) - lets say: $usernick
then i set up a database - say 'userlog' - which has the fields usernick and lastonline - the latter is a timestamp...
then you include this code on every site (preferrably somewhere in the header part - before other db queries):
mysql_query("INSERT INTO userlog (usernick, lastonline) VALUES ('" . $usernick . "', '" . time() . "') ;") ;
and finally to display the right status:
$idleMinutes = 5; //minutes of idle time until status = offline
$idleTime = time() - $idleMinutes * 60;
$onlineResult = mysql_query("SELECT * FROM userlog WHERE usernick = '" . $usernick . "' AND lastonline > " . $idleTime . ";);
if (mysql_num_rows($onlineResult) > 0) {
$img = "online.gif";
}
else {
$img = "offline.gif";
}
print "<IMG SRC=\"" . $img . "\">";
of course this is just a basic scheme and needs some optimization work done - but it should give you an idea of what im hinting at!
rock on!