Файл: index.php
Строк: 170
<?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';
include 'inc/head.php';
/*
echo '<div class="post">Реклама:<br />';
include 'link.php';
include 'link.php';
echo '<hr /></div>';
*/
/// ВЫВОД Разделов
if ($index == 1 && !isset($_GET['c']))
{
mysql_query("DELETE FROM `cache` WHERE `time` < " . ($time - ($setup['cache_time']) * 60 * 10) . " LIMIT 50");
$category = mysql_query("SELECT * FROM `category` ORDER BY `por`;");
echo '<table border="2" width="100%">';
while ($cat = mysql_fetch_array($category))
{
if ($cat['s_name'] == 'vrazdel')
{
echo '<tr class="vraz"><td colspan="2"><img src="ico/' . $cat['ico'] . '.gif" alt="+" width="16" height="16" /> ' . $cat['r_name'] . '</td></tr>';
} elseif ($cat['s_name'] == 'link')
{
$tid = explode('|', $cat['folder']);
$link = mysql_fetch_array(mysql_query("SELECT * FROM `$tid[0]` WHERE `id`='$tid[1]';"));
$count = explode('i', $link['p_i_f']);
echo '<tr class="menu"><td><img src="ico/' . $cat['ico'] . '.gif" alt="+" width="16" height="16" /> <a href="?c=' . $tid[0] . '&id=' . $tid[1] . '">' . $cat['r_name'] . '</a></td><td> [' . $count['0'] . $count['1'] . ']</td></tr>';
} elseif ($cat['s_name'] == 'vlink')
{
echo '<tr class="vraz"><td colspan="2"><img src="ico/' . $cat['ico'] . '.gif" alt="+" width="16" height="16" /> <a href="' . $cat['folder'] . '">' . $cat['r_name'] . '</a></td></tr>';
} else
{
$count = explode('i', $cat['p_i_f']);
$cat['s_name'] = str_replace('files/', '', $cat['s_name']);
echo '<tr class="menu"><td><img src="ico/' . $cat['ico'] . '.gif" alt="+" width="16" height="16" /> <a href="?c=' . $cat['s_name'] . '">' . $cat['r_name'] . '</a></td><td> [' . $count['0'] . $count['1'] . ']</td></tr>';
}
}
echo '</table>';
echo '<hr />';
echo '<div class="navi"><a href="stat.php">Статистика ЗЦ</a> : <a href="set.php">Настройки</a></div>';
/// Удаление временных файлов из папки temp/
$arr_temp = glob('temp/*');
$i = 0;
foreach ($arr_temp as $value)
{
@unlink($value);
$i++;
if ($i > 50)
{
break;
}
}
}
/// ВЫВОД Категорий
elseif (isset($_GET['c']))
{
if ($id != 0)
{
$head_cat = mysql_fetch_array(mysql_query("SELECT `s_name`, `sizetime` FROM `$table` WHERE `id`='$id';"));
}
if (!is_dir($head_cat['s_name'] . '/'))
{
exit('Выбранный раздел не существует');
}
if ($head_cat['sizetime'] < ($time - 3600))
{
$allfiles = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `' . $table . '` WHERE `folder` LIKE "' . $head_cat['s_name'] . '%" AND `type`=2;'));
$allfiles = $allfiles['0'];
$allnew = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `' . $table . '` WHERE `folder` LIKE "' . $head_cat['s_name'] . '%" AND `type`=2 AND `up_time`>' . $new_time . ';'));
$allnew = '/+' . $allnew['0'];
if ($id != 0)
{
mysql_query("UPDATE `$table` SET `p_i_f`='" . $allfiles . "i" . $allnew . "', `sizetime`='$time' WHERE `id`=$id LIMIT 1;");
} else
{
mysql_query("UPDATE `category` SET `p_i_f`='" . $allfiles . "i" . $allnew . "', `sizetime`='$time' WHERE `s_name` = 'files/$table' LIMIT 1;");
}
}
////////// START - ПОСТРАНИЧНАЯ НАВИГАЦИЯ
$k_post = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `' . $table . '` WHERE `id_p`=' . $id . ''));
$k_post = $k_post['0'];
$k_page = k_page($k_post, $step);
$page = page($k_page);
$start = $step * $page - $step;
////////// END - ПОСТРАНИЧНАЯ НАВИГАЦИЯ
$parametr = "$table|$id|$sort|$p|$step|$page|$prev_set|$prev_w|$prev_h|$d_w|$d_h";
if (isset($_GET['set']))
{
include 'inc/set_inc.php';
} else
{
echo "<div class='navi'>
» <a href="?c=$table&id=$list[id]&sort=$sort&p=$p&step=$step&page=$page&set">Настройки</a> : <a href='search.php?c=$table&search'>Поиск</a><br />
» Самые: <a href='top.php?c=$table&id=$id'>скачиваемые</a> : <a href='new.php?c=$table&id=$id'>новые</a><br />
</div>";
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cache` WHERE `parametr` = '$parametr' && `time` > " . ($time - ($setup['cache_time']) * 60) . ""), 0) == 0)
{
$s = mysql_query("SELECT * FROM `$table` WHERE `id_p`=$id ORDER BY `$sort` $por 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&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&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&id=$list[id]'>подробности</a></td></tr><tr><td class='img' width='$prev_w'><img src='image.php?c=$table&id=$list[id]&W=$prev_w&H=$prev_h' alt='скачать " . $file_name . "'/> </td><td class='info'><a class='info' href='file.php?c=$table&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&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 . '&id=' . $list['id'] . '&act=d&W=' . $d_w . '&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&id=$list[id]'>подробности</a></td></tr><tr><td class='img' width='$prev_w'><img src='ffmpeg.php?c=" . $table . "&id=" . $list['id'] . "&W=" . $prev_w . "&H=" . $prev_h . "&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&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&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&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&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';
mysql_query("REPLACE INTO `cache` (`parametr`, `content`, `str`, `time`, `count`) VALUES ('$parametr', '" . mysql_real_escape_string($content) . "', '" . mysql_real_escape_string($str) . "', '$time', '1')");
} else
{
$cache = mysql_fetch_array(mysql_query("SELECT * FROM `cache` WHERE `parametr`='$parametr' LIMIT 1"));
echo $cache['content'] . $cache['str'];
}
}
echo '<div class="navi"><a href="http://mobiwap.su">wap знакомства на WapLover.Net</a><br />';
echo '<b><a href="readme.php">Купить скрипт загруз центра</a></b></div><div>';
include 'inc/foot.php';
?>