<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Форум - TOP 20 файлов'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
if ($set['web'])
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files2`"), 0)>0)
{
?>
<table width='100%' border='1' align='center'>
<tr class='forum_file_table_title'>
<td width='14'>
</td>
<td>
Файл
</td>
<td>
Тип
</td>
<td width='50'>
Размер
</td>
<td width='50'>
Скачано
</td>
<td width='50'>
Рейтинг
</td>
<td width='50'>
</td>
</tr>
<?
$q_f=mysql_query("SELECT COUNT(`forum_files_rating2`.`rating`) AS `c_rating`, SUM(`forum_files_rating2`.`rating`) AS `rating`, `forum_files2`.* FROM `forum_files2` LEFT JOIN `forum_files_rating2` ON
`forum_files2`.`id` = `forum_files_rating2`.`id_file` GROUP BY `forum_files2`.`id` ORDER BY `rating` DESC LIMIT 20");
while ($file = mysql_fetch_assoc($q_f))
{
echo "<tr class='forum_file_table_file'>";
echo "<td>";
if (is_file(H.'style/themes/'.$set['set_them'].'/loads/14/'.$file['ras'].'.png'))
{
echo "<img src='/style/themes/$set[set_them]/loads/14/$file[ras].png' alt='$file[ras]' />";
if ($set['echo_rassh_forum']==1)$ras=".$file[ras]";else $ras=NULL;
}
else
{
echo "<img src='/style/themes/$set[set_them]/forum/14/file.png' alt='' />";
$ras=".$file[ras]";
}
echo "</td>";
echo "<td>$file[name]$ras</td>";
echo "<td>$file[type]</td>";
echo "<td>".size_file($file['size'])."</td>";
echo "<td style='text-align:center;'>$file[count]</td>";
echo "<td style='text-align:center;'> ";
if ($file['rating']==null)$file['rating']=0;
echo "&nbsp;$file[rating]/$file[c_rating]&nbsp;";
echo "</td>";
echo "<td><a href='/forum/files/$file[id]/$file[name].$file[ras]'>Скачать</a></td>";
echo "</tr>";
}
echo "</table><br>";
}
}
else
{
$q_f=mysql_query("SELECT COUNT(`forum_files_rating2`.`rating`) AS `c_rating`, SUM(`forum_files_rating2`.`rating`) AS `rating`, `forum_files2`.* FROM `forum_files2` LEFT JOIN `forum_files_rating2` ON
`forum_files2`.`id` = `forum_files_rating2`.`id_file` GROUP BY `forum_files2`.`id` ORDER BY `rating` DESC LIMIT 20");
while ($file = mysql_fetch_assoc($q_f))
{
if (is_file(H.'style/themes/'.$set['set_them'].'/loads/14/'.$file['ras'].'.png'))
{
echo "<img src='/style/themes/$set[set_them]/loads/14/$file[ras].png' alt='$file[ras]' />";
if ($set['echo_rassh_forum']==1)$ras=".$file[ras]";else $ras=NULL;
}
else
{
echo "<img src='/style/themes/$set[set_them]/forum/14/file.png' alt='' />";
$ras=".$file[ras]";
}
echo "<a href='/forum2/files/$file[id]/$file[name].$file[ras]'>$file[name]$ras</a> (".size_file($file['size']).") ";
echo "<br>";
echo "Рейтинг: ";
if ($file['rating']==null)$file['rating']=0;
echo "&nbsp;$file[rating]/$file[c_rating]&nbsp;";
echo " | ";
echo "Скачано: $file[count] раз(а) ";
echo "<br>";
}
}
echo "<div class=\"foot\">";
echo "&laquo;<a href=\"/forum2/\">Форум</a><br>";
echo "</div>";
include_once '../sys/inc/tfoot.php';
?>