Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   BT.Manager (phpMyBitTorrent) (http://www.bvlist.com/forumdisplay.php?f=23)
-   -   imperialbt statistics code (http://www.bvlist.com/showthread.php?t=6636)

it53lv 26th June 2011 17:11

imperialbt statistics code
 
i think this is messed up
Code:

echo "

Our Statistics





   
       

           

Statistics


           
";
echo "
Torrents
".$tottorrent."
\n";
echo "
We have shared
".mksize($totshare)."
\n";
echo "
Seeders
".$totseeders."
\n";
echo "
Leechers
".$totleechers."
\n";
echo "
Members
".$totuser."
\n";
        echo "
           

       

   
   

           

";
$legend = '';
$sqlev = "SELECT name, color FROM ".$db_prefix."_levels";
$reslev = $db->sql_query($sqlev);
        while ($rowlev = $db->sql_fetchrow($reslev)) {
        $legend .=''.$rowlev['name'].' ';
}
$legend .= '
';
$db->sql_freeresult($reslev);
$sql = "SELECT O.id AS id, O.page AS page, UNIX_TIMESTAMP(O.logged_in) AS logged_in, IF(U.name IS NULL, U.username, U.name) as name, U.donator AS donator, U.warned AS warned, U.can_do as can_do, U.level AS level, U.Show_online AS Show_online, U.uploaded as uploaded, U.downloaded AS downloaded FROM ".$db_prefix."_online_users O LEFT JOIN ".$db_prefix."_users U ON O.id = U.id WHERE UNIX_TIMESTAMP(NOW()-U.lastlogin) < 1800 AND U.Show_online = true;";
$res = $db->sql_query($sql);
$tot = $db->sql_numrows($res);
$i = 1;
$simple = "\n

";
$user_now = $db->sql_numrows($res);
if ($user_now == 0) $simple .= _btnouseronline;
else {
        while ($row = $db->sql_fetchrow($res)) {
        //if($row[id] == $user->id)break;
        if($row["donator"] == 'true')$donator = true;
        else
        $donator = false;
                $simple .= "";
                $simple .= htmlspecialchars($row["name"])."
";
                if ($row["level"] == "premium") $simple .= pic("icon_premium.gif",'','premium');
                elseif ($row["level"] == "moderator") $simple .= pic("icon_moderator.gif",'','moderator');
                elseif ($row["level"] == "admin") $simple .= pic("icon_admin.gif",'','admin');
    if($donator) $simple .= 'donator';
    if($row["warned"] == "1") $simple .= 'warned';
                if ($i < $tot) $simple .= ", ";
                $i++;
 
        }
        $simple .= "";
}
$db->sql_freeresult($res);
        echo"$simple";
echo " $user_now active user(s) (in past 5 minutes)
                $legend
           


       

";


joeroberts 26th June 2011 17:13

where is the query for stats? did you change it?

it53lv 26th June 2011 17:15

yes i taked out a lot
query thing starts AFTER
Code:

echo "

Our Statistics





   
       

           

Statistics


           
";
echo "
Torrents
".$tottorrent."
\n";
echo "
We have shared
".mksize($totshare)."
\n";
echo "
Seeders
".$totseeders."
\n";
echo "
Leechers
".$totleechers."
\n";
echo "
Members
".$totuser."
\n";
        echo "
           

       

   
   

           

";


joeroberts 26th June 2011 17:17

I still need to see the complete code if Im to help improve it.

it53lv 26th June 2011 17:49

all the code is in my first post there is noting else for this block
everything else in index.php is basicly the same as original only some blocks are comented out
old statistics function is removed :sad:
basicly that's all there is changed in index.php

joeroberts 26th June 2011 18:56

Quote:

Originally Posted by it53lv (Post 28627)
all the code is in my first post there is noting else for this block
everything else in index.php is basicly the same as original only some blocks are comented out
old statistics function is removed :sad:
basicly that's all there is changed in index.php

that's why it's not working you removed the part that gets the information
I well look at it l8r as I got stuff going on here rite now.

it53lv 26th June 2011 19:03

ok it's not realy important at this point so no wories

joeroberts 27th June 2011 00:52

try this
PHP Code:

echo "
<div class=\"maintitle_base\"><div class=\"header_left\"><div class=\"header_right\">
<h3 class=\"maintitle\"> Our Statistics</h3>
</div></div></div>
<div class=\"border2\"> 
<div id=\"board_statistics\" class=\"statistics stats_container\"> 
    
        <div id=\"stats\"> 
            <h2> Statistics</h2> 
            <dl> "
;
        
//Total Torrents and their size
        
$sql "SELECT COUNT(id), SUM(size) FROM ".$db_prefix."_torrents;";
        
$res $db->sql_query($sql);
        list (
$tottorrent$totshare) = $db->sql_fetchrow($res);
        
$db->sql_freeresult($res);
echo 
"<dt>"._btindex_totaltorrents."</dt><dd>".$tottorrent."</dd>\n"
echo 
"<dt>"._btindex_totalshare."</dt><dd>".mksize($totshare)."</dd>\n";
        
//Total seeders and total leechers
        
$sql "SELECT COUNT(id) FROM ".$db_prefix."_peers GROUP BY seeder ORDER BY seeder ASC;";
        
$res $db->sql_query($sql);
        list (
$totseeders) = $db->sql_fetchrow($res);
        list (
$totleechers) = $db->sql_fetchrow($res);
        
$db->sql_freeresult($res);
echo 
"<dt>"._btindex_totalseeders."</dt><dd>".$totseeders."</dd>\n";
echo 
"<dt>"._btindex_totalleechers."</dt><dd>".$totleechers."</dd>\n";
        
//Total users
        
$sql "SELECT COUNT(id) FROM ".$db_prefix."_users;";
        
$res $db->sql_query($sql);
        list (
$totuser) = $db->sql_fetchrow($res);
        
$db->sql_freeresult($res);
echo 
"<dt>"._btindex_totalregister."</dt><dd>".$totuser."</dd>\n";
        echo 
"
            </dl> 
        </div> 
    
    <div id=\"active_users\" class=\"stats_list\"> 
            <h2>"
;
$legend '<b>'
$sqlev "SELECT name, color FROM ".$db_prefix."_levels"
$reslev $db->sql_query($sqlev); 
        while (
$rowlev $db->sql_fetchrow($reslev)) { 
        
$legend .='<a href="memberslist.php?mode=group&g='.$rowlev['name'].'" style="color: '.$rowlev['color'].'; font-weight: bold;">'.$rowlev['name'].'</a> '

$legend .= '</b>'
$db->sql_freeresult($reslev); 
$sql "SELECT O.id AS id, O.page AS page, UNIX_TIMESTAMP(O.logged_in) AS logged_in, IF(U.name IS NULL, U.username, U.name) as name, U.donator AS donator, U.warned AS warned, U.can_do as can_do, U.level AS level, U.Show_online AS Show_online, U.uploaded as uploaded, U.downloaded AS downloaded FROM ".$db_prefix."_online_users O LEFT JOIN ".$db_prefix."_users U ON O.id = U.id WHERE UNIX_TIMESTAMP(NOW()-U.lastlogin) < 1800 AND U.Show_online = true;"
$res $db->sql_query($sql); 
$tot $db->sql_numrows($res); 
$i 1
$simple "\n<p>"
$user_now $db->sql_numrows($res); 
if (
$user_now == 0$simple .= _btnouseronline
else { 
        while (
$row $db->sql_fetchrow($res)) { 
        
//if($row[id] == $user->id)break; 
        
if($row["donator"] == 'true')$donator true
        else 
        
$donator false
                
$simple .= "<a href=\"user.php?op=profile&id=".$row["id"]."\"><font color=\"".getusercolor($row["can_do"])."\">"
                
$simple .= htmlspecialchars($row["name"])."</font></a>"
                if (
$row["level"] == "premium"$simple .= pic("icon_premium.gif",'','premium'); 
                elseif (
$row["level"] == "moderator"$simple .= pic("icon_moderator.gif",'','moderator'); 
                elseif (
$row["level"] == "admin"$simple .= pic("icon_admin.gif",'','admin'); 
    if(
$donator$simple .= '<img src="images/donator.gif" height="16" width="16" title="donator" alt="donator" />'
     if(
$row["warned"] == "1"$simple .= '<img src="images/warning.gif" title="warned" alt="warned" />'
                if (
$i $tot$simple .= ", "
                
$i++; 
 
        } 
        
$simple .= ""

$db->sql_freeresult($res);
        echo
"$simple";
echo 
$user_now active user(s) <span>(in past 5 minutes)</span> 
                <span class=\"desc\">
$legend</span> 
            </h2> 
        </div>
</div></div>"



it53lv 27th June 2011 00:54

perfect :bubble:

CanonSems 28th October 2011 15:47

all the code is in my first post there is noting else for this block
everything else in index.php is basicly the same as original only some blocks are comented out


All times are GMT +2. The time now is 12:24.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.