View Single Post
Old 08-29-2004, 08:56 AM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
that file includes other files and uses classes i don't use, so it is no use me trying to debug it unless i want to spend more time than i have creating all that.

here is what i came up with going through the script line by line. view the comments. i could not test it, but this should help.
PHP Code:
<?php
include("header.php");  
$index 0;    
//require_once("mainfile.php");    
$module_name basename(dirname(__FILE__));
 
function 
who_online() {   
  global 
$prefix$db;   
  
$sql "SELECT uname, guest FROM ".$prefix."_session WHERE guest = 0";   
  
$result $db->sql_query($sql);   
  
$member_online_num $db->sql_numrows($result);   
  
$who_online_now "";   
  
$i 1;
  
  
OpenTable();  
  
$count 0;  
  echo 
"<table border=\"1\" cellspacing=\"10\" cellpadding=\"10\">";
   
  while(
$session $db->sql_fetchrow($result)) {  
     
    if(isset(
$session["guest"]) and $session["guest"] == 0) {   
      
$sql ="select user_id from ".$prefix."_users where username='$session[uname]'";
      
      list(
$user_id) = mysql_fetch_row(mysql_query($sql));
      
$count++;   
               
      if(
$count == 1) { echo "<tr>"; }
      
      if(
file_exists("/home/virtual/site13/fst/var/www/html/modules/Photo/memberphotos/$user_id.jpg")) {
        
$who_online_now .= "<TD><center><A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">
          <img src=\"modules/Photo/memberphotos/$user_id.jpg\" border=\"0\" alt=\"$session[uname]\">
          <br>$session[uname]</center></TD></a>\n"
;
        
        if(
$count == 3)   { echo "</tr>"$count=0; }   
      }
    }
  }

  if(
$count == 1) { echo "<td>&nbsp;</td><td>&nbsp;</td></tr>"; }
  if(
$count == 2) { echo "<td>&nbsp;</td></tr>"; }
  echo 
"</table>";
  
  
// up to here looks good, we printed and closed the user table
  // *************************
  // what is the rest of this for?
  // it looks like a bad copy and paste or something.
  
  // begin commenting out bad code
  /*
  $count++;   
  if($count == 1) { echo "<tr>"; }       
  $i++;
  
  }
  
  elseif(file_exists("/home/virtual/site13/fst/var/www/html/modules/Photo/memberphotos/$user_id.gif")) {
    $who_online_now .= "<TD><center><A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">
    <img src=\"modules/Photo/memberphotos/$user_id.gif\" border=\"0\" alt=\"$session[uname]\"><br>$session[uname]</center></TD></a>\n";
    if($count == 3)   { echo "</tr>"; }   
    if($count == 3)   { $count = 0; }   
  }
 }
}

if($count == 1) { echo "<td>&nbsp;</td><td>&nbsp;</td></tr>"; }
if($count == 2) { echo "<td>&nbsp;</td></tr>"; }
echo "</table>";
$i++;
    }
  }   
  
  }
  // end commenting out bad code
  */
  
 
return $who_online_now;   
}
// here the function is ended

$some_stuff who_online();  
echo 
"$some_stuff";
CloseTable();
include(
"footer.php");  
  
// } this closing brace does not belong here
?>
__________________
Mike
sde is offline   Reply With Quote