Who's online?!

Hi, is there anyway to integrate a php code to know the user’s online?

Thanks,

Hi Eliaskho,
Yes you can see who is online. This example is based on the Scriptcase security module. Please follow these steps.

[SIZE=5]Example to see who is online[/SIZE]
1- Create a new field on the users_table and name it ‘timestamp’ as varchar(15)
2- Create a new library and save as “who.php” and create these functions


    function who_update() { 
       $timestamp= time(); 
       sc_exec_sql("UPDATE users_table SET timestamp='$timestamp' WHERE login='".[usr_login]."' ");  
    } 

3- Include your library on all your apps and call the function who_update() onLoad.

QUERY To see who is online on the last 10 minutes


$last_10_minutes=time()-600; // 600 seconds are 10 minutes
sc_lookup(ds, "SELECT login from users_table WHERE timestamp < $last_10_minutes");

Super! I am going to try that.