block-stats с 1 запросом - Форум вебмастеров-Моды и хаки для трекера
Страница 1 из 11
Форум вебмастеров-Моды и хаки для трекера » Моды и Хаки » Готовые моды и хаки » block-stats с 1 запросом (block-stats с 1 запросом)
block-stats с 1 запросом
Slash3977Дата: Воскресенье, 27.06.2010, 20:44 | Сообщение # 1
Админ!и что?
Группа: Администраторы
Сообщений: 74
Репутация: 3
Статус: Offline

Code
<?php   

if (!defined('BLOCK_FILE')) {   
location("../index.php");   
exit;   
}   
global $tracker_lang, $ss_uri, $maxusers, $CURUSER, $use_sessions;   
$blocktitle = $tracker_lang['statistic'];   
$sql = sql_query("SELECT id, username, downloaded, (SELECT COUNT(*) FROM users WHERE warned='yes') AS warneds, (SELECT COUNT(*) FROM users WHERE enabled='no') AS disabled, (SELECT COUNT(*) FROM users WHERE gender='1') AS males, (SELECT COUNT(*) FROM users WHERE gender='2') AS females, (SELECT COUNT(*) FROM users WHERE status='pending') AS pendings, (SELECT COUNT(*) FROM torrents WHERE filename<>'') AS torrents, (SELECT COUNT(*) FROM torrents WHERE filename<>'' AND visible='no') AS dead, (SELECT COUNT(*) FROM torrents WHERE times_completed>0) AS downtor, (SELECT COUNT(*) FROM peers WHERE seeder='yes') AS seeders, (SELECT COUNT(*) FROM peers WHERE seeder='no') AS leechers FROM users WHERE status='confirmed' ORDER BY id") or sqlerr(__FILE__,__LINE__);   
$num = 0;   
while ($us = mysql_fetch_array($sql)) {   
$num++;   
$downloaded += $us["downloaded"];    
if ($num == mysql_num_rows($sql)) {   
if ($CURUSER)   
     $latestuser = "<a href=userdetails.php?id=" . $us["id"] . " class=\"online\">" . $us["username"] . "</a>";   
else   
     $latestuser = $us['username'];   
$registered = number_format($us["males"]+$us["females"]);   
$unverified = number_format($us["pendings"]);   
$male = number_format($us["males"]);   
$female = number_format($us["females"]);   
$torrents = number_format($us["torrents"]);   
$dead = number_format($us["dead"]);   
$downtor = number_format($us["downtor"]);   
$seeders = $us["seeders"];   
$leechers = $us["leechers"];   
$warned_users = number_format($us["warneds"]);   
$disabled = number_format($us["disabled"]);   
$downstat = 0;   
$upsta = 0;   
}   
}   
while ($upl = mysql_fetch_array($sql)) {   

}   
$downstatu = mksize($downstat);   
$dow = mysql_query("SELECT size FROM torrents") or sqlerr(__FILE__,__LINE__);   
while ($down = mysql_fetch_array($dow)) {   
$upsta = $upsta + $down["size"];   
}   
$upstat = mksize($upsta);   
if ($leechers == 0)   
   $ratio = 0;   
else   
   $ratio = round($seeders / $leechers * 100);   
$peers = number_format($seeders + $leechers);   
$seeders = number_format($seeders);   
$leechers = number_format($leechers);   

$content .= "<table width=\"100%\" class=\"main\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><td align=\"center\">  
<table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">  

<table width=\"100%\" class=\"main\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">  
   <tr>  
     <td width=\"50%\" align=\"center\" style=\"border: none;\"><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">  
<tr><td class=\"rowhead\">Зарегистрированных</td><td align=right>$registered</td></tr>  
<tr><td class=\"rowhead\">Парней <img src=\"pic/male.gif\" border=0 align=absbottom></td><td align=right>$male</td></tr>  
<tr><td class=\"rowhead\">Девушек <img src=\"pic/female.gif\" border=0 align=absbottom></td><td align=right>$female</td></tr>  
<tr><td colspan=\"2\" class=\"rowhead\"><table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\"><tr><td style=\"text-align: right; font-weight: bold; vertical-align: top;\">Мест на трекере</td><td align=\"right\">$maxusers</td></tr></table></td></tr>  
<tr><td class=\"rowhead\">Неподтвержденных </td><td align=right>$unverified</td></tr>  
<tr><td class=\"rowhead\">Предупреждённых  <img src=\"pic/warned.gif\" border=0 align=absbottom></td><td align=right>$warned_users</td></tr>  
<tr><td class=\"rowhead\">Отключенных  <img src=\"pic/disabled.gif\" border=0 align=absbottom></td><td align=right>$disabled</td></tr>  
<tr><td class=\"rowhead\">Директор <img src=\"pic/info/sysop.gif\" border=0 align=absbottom></td><td align=right>    Skyline</td></tr>  

</table></td>  
<td width=\"50%\" align=\"center\" style=\"border: none;\"><table class=main border=1 cellspacing=0 cellpadding=5>  
<tr><td style=\"text-align: right; font-weight: bold; vertical-align: top;\"><a href=\"browse.php\">Торрентов</a></td><td align=right >$torrents</td></tr>   
<tr><td class=\"rowhead\">Всего залито</td><td align=right>$upstat</td></tr>  
<tr><td class=\"rowhead\">Всего скачано торрентов</td><td align=right>$downtor шт.</td></tr>  
<tr><td style=\"text-align: right; font-weight: bold; vertical-align: top;\"><a href=\"browse.php?search=&incldead=2&cat=0\">Мертвых торрентов</a></td><td align=right>$dead</td></tr>  
<tr><td class=\"rowhead\">Активных подключений</td><td align=right>$peers</td></tr>";  
if (isset($peers)) {  

$content .= "<tr><td class=\"rowhead\" >Раздающих   <img src=\"./themes/$ss_uri/images/arrowup.gif\" border=0 align=absbottom></td><td align=right>$seeders</td></tr>  
<tr><td class=\"rowhead\">Качающих   <img src=\"./themes/$ss_uri/images/arrowdown.gif\" border=0 align=absbottom></td><td align=right>$leechers</td></tr>  
<tr><td class=\"rowhead\">Раздающих/Качающих (%) </td><td align=right>$ratio</td></tr>";  
}  

$content .= "</table></td>  

</table>  
</td></tr></table>";  
?>
Прикрепления: 6810637.png(47Kb)
 
Форум вебмастеров-Моды и хаки для трекера » Моды и Хаки » Готовые моды и хаки » block-stats с 1 запросом (block-stats с 1 запросом)
Страница 1 из 11
Поиск: