Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Dėl online

Parašė Dandžu· 2008 Kov. 3 20:03:25
#1

Turiu čia tokį kodą pasidaręs, bet man reikia padaryti, kad vienoje eilutėje būtų 5 nariai ir kitoje eilutėje 5 nariai nu, kad būtų 10 tokių eilučių. Čia prisijungusių narių. Nes dabar man taip niekaip nesigauna.
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";

opentable("<img src='http://ssound.xz.lt/themes/Street-Sound_2007/paneles/nariai-prisijunge.png'>");
 $cond = ($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'");
 $result = dbquery("SELECT * FROM ".$db_prefix."online WHERE online_user=".$cond."");
 if (dbrows($result) != 0) {
  $result = dbquery("UPDATE ".$db_prefix."online SET online_lastactive='".time()."' WHERE online_user=".$cond."");
 } else {
  $name = ($userdata['user_level'] != 0 ? $userdata['user_id'] : "0");
  $result = dbquery("INSERT INTO ".$db_prefix."online (online_user, online_ip, online_lastactive) VALUES ('$name', '".USER_IP."', '".time()."')");
 }
 $result = dbquery("DELETE FROM ".$db_prefix."online WHERE online_lastactive<".(time()-60)."");
 $result = dbquery(
  "SELECT ton.*, tu.user_id,user_name FROM ".$db_prefix."online ton
  LEFT JOIN ".$db_prefix."users tu ON ton.online_user=tu.user_id"
 );
 $guests = 0; $members = array();
 while ($data = dbarray($result)) {
  if ($data['online_user'] == "10") {
   $guests++;
  } else {
   array_push($members, array($data['user_id'], $data['user_name']));
  }
 }


$result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_lastvisit>'0' AND user_status='0' ORDER BY user_lastvisit DESC LIMIT 0,10");
if (dbrows($result) != 0) {
 while ($data = dbarray($result)) {
  $lastseen = time() - $data['user_lastvisit'];
  $iW=sprintf("%2d",floor($lastseen/604800));
  $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
  $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
  $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
  $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
  if ($lastseen < 60){
   $lastseen= Online;
  } elseif ($lastseen < 360){
   $lastseen="< 5min";
  } elseif ($iW > 0){
   if ($iW == 1) { $text = Savait&#235;; } else { $text = Savait&#235;s; }
   $lastseen = $iW." ".$text;
  } elseif ($iD > 0){
   if ($iD == 1) { $text = Diena; } else { $text = Dienos; }
   $lastseen = $iD." ".$text;
  } else {
   $lastseen = $iH.":".$iM.":".$iS;
  }
      echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl'>\n<tr>\n";
         echo "<td align='center' valign='top' width='20%'>";
 if ($data['user_avatar'] != "") {
 echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."<br><img src='".BASEDIR."images/avatars/".$data['user_avatar']."' width='100' height='100'></a><br>\n";
 $lvisit = time() - $data['user_lastvisit'];
 if ($lvisit < 60) echo "<img src='".BASEDIR."images/prisijunges.gif'>";
 elseif ($lvisit < 300) echo "<img src='".BASEDIR."images/pries-5-min.gif'>";
 else echo "<img src='".BASEDIR."images/atsijunges.png'>";
 }
)
         echo "</td>\n";
      }
      echo "</tr>\n</table>\n";
}
closetable();


require_once "side_right.php";
require_once "footer.php";
?>