Hey, heres the problem.

from a control panel a member can change their status Available/Not available/busy which is put into a MySQL Table with their record.

Now i need it so an .html page can parse this information and return an appropriate icon like ICQ Status Indicators

Ex- if a person was offline an image should appear that would represent them being offline, if online one for online if busy one for busy.

How do I go about doing this? I looked at ICQ's code but its just an IMG SRC Tag to a script not an actual image.

Any ideas or pointers to tutorials for this?

Thanks in advance

    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!

      Write a Reply...