Advanced Search

Results 1 to 3 of 3

Thread: user online.. help

  1. #1
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default user online.. help

    I have asked this question before and got no anwser...

    What I am trying to do is show if the user is online like myspace has it..
    I use sessions and was wondering what I could do to make this happen..
    I can't find any tutorials out there for this..

    in my sessions I have this.
    HTML Code:
       function startSession(){
          global $database;  //The database connection
          session_start();   //Tell PHP to start the session
    
          $this->logged_in = $this->checkLogin();
    
          /* Update timestamp */
          else{
             $database->addActiveUser($this->username, $this->time);
          }
          
    what that does it checks user online then update timestamp, I was wondering how I could user this in order to show(when a user visits a users profile) them online.

    any help please,...
    Hey new design new look, goto xudas for personal webdsign help.. (:

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    Have a list populated at login and cleared of any old ones with each use of the script.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    can you give me example. what do you mean have a list populated, also

    I have a online script that shows users online if this is any help..
    Code:
    <?
    if(!defined('TBL_ACTIVE_USERS')) {
      die("Error processing page");
    }
    
    $q = "SELECT username FROM ".TBL_ACTIVE_USERS
        ." ORDER BY timestamp DESC,username";
    $result = $database->query($q);
    
    $num_rows = mysql_numrows($result);
    if(!$result || ($num_rows < 0)){
       echo "Error displaying info";
    }
    else if($num_rows > 0){
    
       echo "<table align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo "<tr><td><font size=\"2\">\n";
       for($i=0; $i<$num_rows; $i++){
          $uname = mysql_result($result,$i,"username");
    
          echo "/ <a href=\"login/userinfoo.php?user=$uname\">$uname</a> ";
       }
       echo "</font></td></tr></table><br>\n";
    }
    ?>
    it may be to some use...
    Hey new design new look, goto xudas for personal webdsign help.. (:

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •