Announcement

Collapse
No announcement yet.

Who's online?!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Who's online?!

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

    Thanks,

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

    Example to see who is online
    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

    PHP Code:
        function who_update() { 
           
    $timestamptime(); 
           
    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
    PHP Code:
    $last_10_minutes=time()-600// 600 seconds are 10 minutes
    sc_lookup(ds"SELECT login from users_table WHERE timestamp < $last_10_minutes"); 
    Last edited by hirambq; 02-27-2013, 04:38 PM.
    Best Regards
    Hiram BQ

    Comment


    • #3
      Super! I am going to try that.

      Comment

      Working...
      X