Вход Регистрация
Файл: top.php
Строк: 118
<?php

/**
 * @author [FaNiska]
 * @copyright 2009
 * Загруз центр
 * Предложения, идеи, вопросы и об ошибках писать в icq 65-64-538 или на mobi-m-ru@ya.ru
 */
include 'inc/db_connect.php';
include 
'inc/function.php';
include 
'inc/set.php';
if (!isset(
$_GET['c']))
{
    
header("location: index.php?error=invalid_id");
    exit();
}
if (
$id != 0)
{
    
$top_cat = mysql_fetch_array(mysql_query("SELECT `s_name` FROM `$table` WHERE `id`='$id';"));
} elseif (isset(
$table) && $id == 0)
{
    
$top_cat['s_name'] = 'files/' . $table;
}
if (!
is_dir($top_cat['s_name'] . '/'))
{
    exit(
'Выбранный раздел не существует');

}
$u_title = 'Самые популярные файлы категории';
include 
'inc/head.php';
$k_post = 100;
$k_page = k_page($k_post, $step);
$page = page($k_page);
$start = $step * $page - $step;
$s = mysql_query("SELECT * FROM `$table` WHERE `s_name` LIKE  '$top_cat[s_name]%' AND `type`=2 ORDER BY `count` DESC LIMIT $start, $step");
$content = '<table width="100%">';
while (
$list = mysql_fetch_array($s))
{
    if (
$list['type'] == 1)
    {


        
$count = explode('i', $list['p_i_f']);
        
$allfiles = $count['0'];
        
$allnew = $count['1'];


        
$list['r_name'] = str_replace('*', '', $list['r_name']);
        if (
$list['gr_id'] > 0 && $list['gr_id'] < 6)
        {
            switch (
$list['gr_id'])
            { 
// Стандартные иконки групп. Можете изменять тут.
                
case '1':
                    
$ico = "<img src='ext/mo.gif' alt='+' width='16' height='16'/> ";
                    break;
                case 
'2':
                    
$ico = "<img src='ext/jar.gif' alt='+' width='16' height='16'/> ";
                    break;
                case 
'3':
                    
$ico = "<img src='ext/mp3.gif' alt='+' width='16' height='16'/> ";
                    break;
                case 
'4':
                    
$ico = "<img src='ext/sis.gif' alt='+' width='16' height='16'/> ";
                    break;
                case 
'5':
                    
$ico = "<img src='ext/3gp.gif' alt='+' width='16' height='16'/> ";
                    break;
            }


            
$content = $content . "<tr><td> $ico <a href='group.php?c=$table&amp;id=$list[id]'>$list[r_name]</a></td><td>[$allfiles$allnew]</td></tr>";
        } else
        {
            
$content = $content . "<tr><td><img src='ico/$list[ico].gif' alt='+' /> <a href='index.php?c=$table&amp;id=$list[id]'>$list[r_name]</a></td><td>[$allfiles$allnew]</td></tr>";
        }

    } elseif (
in_array($list['f_ras'], $arr_ext)) //////  ФИЛЬТР ПО РАСШИРЕНИЮ

    
{
        
$list['r_name'] = str_replace('*', '', $list['r_name']);
        if (
$prev_set == 1 && isset($prev_h) && isset($prev_w))
        { 
// Если предпросмотр включен

            
if ($list['f_ras'] == 'jpg' || $list['f_ras'] == 'jpeg' || $list['f_ras'] == 'png' || $list['f_ras'] == 'gif')
            {
                
$content = $content . "<tr class='block'><td colspan='2'> $list[r_name] <a class='info' href='file.php?c=$table&amp;id=$list[id]'>подробности</a></td></tr><tr><td class='img' width='$prev_w'><img src='image.php?c=$table&amp;id=$list[id]&amp;W=$prev_w&amp;H=$prev_h' alt='скачать " . $file_name . "'/> </td><td  class='info'><a class='info' href='file.php?c=$table&amp;id=$list[id]'>$list[r_name]</a> " . size_file($list['size']) . "<br />";
                if (
function_exists('getimagesize'))
                {
                    
$img_size = getimagesize($list['s_name']);
                    
$x = "($img_size[0]x$img_size[1])";
                } else
                {
                    
$x = '';
                }

                
$content = $content . "<a class='info' href='load_img.php?c=$table&amp;id=$list[id]'>Скачать оригинал $x</a><br />
                            Кол-во скачиваний: 
$list[count]<br />";


                if (isset(
$d_w) && isset($d_h))
                {
                    
$content = $content . '<a class='info' href="image.php?c=' . $table . '&amp;id=' . $list['id'] . '&amp;act=d&amp;W=' . $d_w . '&amp;H=' . $d_h . '">Скачать ' . $d_w . 'x' . $d_h . '</a>
                    </td></tr>'
;
                } else
                    
$content = $content . "</td></tr>";

            } elseif (
$list['f_ras'] == '3gp' || $list['f_ras'] == 'mp4' || $list['f_ras'] == 'avi') // можете расширить сами если ваш хостинг поддерживает другие форматы

            
{
                
$content = $content . "<tr class='block'><td colspan='2'> $list[r_name] <a class='info' href='file.php?c=$table&amp;id=$list[id]'>подробности</a></td></tr><tr><td class='img' width='$prev_w'><img src='ffmpeg.php?c=" . $table . "&amp;id=" . $list['id'] . "&amp;W=" . $prev_w . "&amp;H=" . $prev_h . "&amp;k=20' alt='" . $list['r_name'] . " " . $list['f_ras'] . "'></td><td  class='info'>Размер: " . size_file($list['size']) . "<br /><a class='info' href='load.php?c=$table&amp;id=$list[id]'>Скачать $list[f_ras]</a><br />
                    Кол-во скачиваний: 
$list[count]</td></tr>";
            } else
            {
                
$screen = eregi_replace($list['f_ras'] . '$', '', $list['s_name']);

                
$arr_sc = glob($screen . '*');
                foreach (
$arr_sc as $value)
                {
                    if (
eregi('.gif$|.png$|.jpeg$|.jpg$', $value))
                    {
                        
$img = "<img src="screen.php?file={$value}" alt="" />";
                        break;
                    } else
                    {
                        
$img = '';
                    }
                }
                if (!isset(
$img) || empty($img))
                {
                    
$img = "<img src='ext/$list[f_ras].gif' alt='+' width='16' height='16'/>";
                }
                
$content = $content . "<tr class='block'><td colspan='2'> $list[r_name] <a class='info' href='file.php?c=$table&amp;id=$list[id]'>подробности</a></td></tr><tr><td class='img' width='$prev_w'>$img</td><td  class='info'>
                        
                         Размер: " 
. size_file($list['size']) . "<br />
                         Скачиваний: 
$list[count]<br />
                         <a class='info' href='load.php?c=
$table&amp;id=$list[id]'>скачать $list[f_ras]</a></td></tr>";
            }

        } else
        {
            
$content = $content . "<tr><td><img src='ext/$list[f_ras].gif' alt='+' width='16' height='16'/> <a href='file.php?c=$table&amp;id=$list[id]'>$list[r_name]</a></td><td>" . size_file($list['size']) . "</td></tr>";
        }


    }

}
$content = $content . '</table>';
echo 
$content;
include_once 
'inc/str.php';
include 
'inc/foot.php';

?>
Онлайн: 3
Реклама