Файл: fo/pages/top.php
Строк: 172
<?php
if (!defined('SECURED'))
{
die("Unknown Error!");
}
include'includes/func_pages.php';
include'includes/func_formatsize.php';
$id = intval($_GET['id']);
$for = ($_GET['for']=='files' ? 'files' : 'users');
$type = (in_array($_GET['type'], array(1,2,3,4,5)) ? $_GET['type'] : 1);
if($for=='files')
{
title('ТОП-100 файлов по разделам');
div('ТОП-100 файлов по разделам','b');
echo'<img src="images/up.gif" alt="[UP]"/><a href="'.$_SERVER['PHP_SELF'].'?'.SID.'">На главную</a><br/>';
echo $separator;
$q=mysql_query("select * from categorys where parent='0' order by position;");
while($category=mysql_fetch_array($q))
{
$text='<img src="images/dir.gif" alt="[DIR]"/> ';
$text.='<a href="'.$_SERVER['PHP_SELF'].'?mode=top&for='.$for.'&id='.$category['id'].'&'.SID.'">'.$category['name'].'</a><br/>';
if($category['id']==$id) $text="<b>$text</b>";
echo $text;
}
if(!empty($id))
{
echo $separator;
$base_url=$_SERVER['PHP_SELF']."?mode=top&for=$for&id=$id";
$num_items=mysql_result(mysql_query("select count(id) from files where refcat='$id';"),0);
if($num_items>100) $num_items=100;
$pages = ceil($num_items/$config['files_on_page']);
if(!empty($_REQUEST['page']))
{
$page = intval($_REQUEST['page']);
if($page<=0) $page=1;
if($page>=$pages) $page=$pages;
} else
{
$page = 1;
}
$start = $page * $config['files_on_page'] - $config['files_on_page'];
$max=$start+$config['files_on_page'];
if($max>$num_items) $max=$num_items;
$total_files = $start + 1;
if($num_items==0) $total_files=0;
echo '<b>Файлы '.$total_files.'-'.$max.' из '.$num_items.'</b><br/>';
echo $separator;
$q=mysql_query("select * from files where refcat='$id' order by downloads desc limit $start,".$config['files_on_page'].";");
while($file=mysql_fetch_array($q))
{
# ДЕЛАЕМ ВЫВОД СКРИНОВ В ФАЙЛ #
$ext=pathinfo($file['filename'],PATHINFO_EXTENSION);
if($ext == 'thm' or $ext == 'nth') {
echo '<img src="theme.php?f='.$file['filename'].'&w=35&h=45" alt="'.basename($file['filename']).'" /><br/>';
}
if($ext=='jpg' or $ext=='gif' or $ext=='png' or $ext=='bmp' or $ext=='jpeg'){
print '<img src="pic_index.php?file='.$file['filename'].'" alt="'.basename($file['filename']).'" /><br/>';}
if(class_exists('ffmpeg_movie')) ///ПРВЕРЯЕМ ЕСТЬ ЛИ НА СЕРВЕРЕ FFMPEG-PHP
{
if($ext=='3gp' or $ext=='3gpp' or $ext=='mp4' or $ext=='avi' or $ext=='mpeg' or $ext=='mov' or $ext=='mpg' or $ext=='rm'){
echo '<img src="ffmpeg_index.php?pic='.$file['filename'].'" alt="'.basename($file['filename']).'" /><br/>';
}
}
# КОНЕЦ ВЫВОДА СКРИНОВ#
echo '• <a href="'.$_SERVER['PHP_SELF'].'?mode=file&id='.$file['id'].'&'.SID.'">'.basename($file['filename']).'</a> ('.$file['downloads'].' скачиваний)<br/>';
//echo '» '.$file['desc'].'<br/>';
$text = explode(' ',$file['desc']);
echo '» '.$text[0].' '.$text[1].' '.$text[2].' '.$text[3].' '.$text[4].'<br/>';
}
$page_links=pages($base_url, $pages, $page);
if(!empty($page_links)) echo $separator.$page_links;
}
} elseif($for=='users'){
if(!isset($_GET['all'])){
$base_url=$_SERVER['PHP_SELF']."?mode=top&for=$for&type=$type";
title('ТОП-100 юзеров');
div('ТОП-100 юзеров','b');
echo'<img src="images/up.gif" alt="[UP]"/><a href="'.$_SERVER['PHP_SELF'].'?'.SID.'">На главную</a><br/>';
echo $separator;
$sort_modes = array(1=>'Залили больше всего файлов', 2=>'Скачали больше всего файлов', 3=>'Залили больше всего мегабайт', 4=>'Скачали больше всего мегабайт', 5=>'Больше всего комментариев');
foreach($sort_modes as $sort_id=>$sort_name)
{
$link='<img src="images/co.gif" alt="[CO]"/> ';
$link.='<a href="'.$_SERVER['PHP_SELF'].'?mode=top&for='.$for.'&type='.$sort_id.'&'.SID.'">'.$sort_name.'</a><br/>';
if($sort_id==$type) $link="<b>$link</b>";
echo $link;
}
echo $separator;
}else{
title('Всего зарегистрированых');
div('Зарегистрированых','b');
$base_url=$_SERVER['PHP_SELF']."?mode=top&for=$for&all";
}
$num_items=mysql_result(mysql_query("select count(id) from users;"),0);
if($num_items>100) $num_items=100;
$pages = ceil($num_items/$config['users_on_page']);
if(!empty($_REQUEST['page']))
{
$page = intval($_REQUEST['page']);
if($page<=0) $page=1;
if($page>=$pages) $page=$pages;
} else
{
$page = 1;
}
$start = $page * $config['users_on_page'] - $config['users_on_page'];
$max=$start + $config['users_on_page'];
if($max>$num_items) $max=$num_items;
$total_users = $start + 1;
if($num_items==0) $total_files=0;
echo '<b>Юзеры: '.$num_items.'</b><br/>';
echo $separator;
switch($type)
{
case 1:
$q=mysql_query("select id,login,sex,upl_files from users order by upl_files desc;");
while($dbuser=mysql_fetch_array($q))
{
$users[] = '• <a href="'.$_SERVER['PHP_SELF'].'?mode=user&id='.$dbuser['id'].'&'.SID.'">'.$dbuser['login'].'</a> ('.($dbuser['sex']==2 ? 'залила' : 'залил').' '.$dbuser['upl_files'].' файлов)<br/>';
}
$start = $_GET['start'];
$all = count($users);
$count = $all;
if(empty($start)) $start=0;
$start = intval($start);
if($start < 0)
$start=0;
if($count > $start + 15) $count = $start + 15;
for($i = $start;$i < $count;$i++)
{
print $users["$i"];
}
//////////////////////////////////////////////////////////////
$counter = count($users);
$max_mess=15;
$start= $_GET['start'];
if($counter>0){
$ba=ceil($start/$max_mess);
$ba2=$ba*$max_mess-$start;
$asd=$start-($max_mess*3);
$asd2=$start+($max_mess*15);
if($asd<$counter && $asd>0){echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=0&".SID.""> 1 </a> ... ";}
for($i=$asd; $i<$asd2;)
{
if($i<$counter && $i>=0){
$ii=floor(1+$i/$max_mess);
if ($start==$i) {
echo ''.$ii.'';
}
else {
echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=$i&".SID.""> [$ii] </a>";
}}
$i=$i+$max_mess;}
if($asd2<$counter){echo ' ... ';}
}
break;
case 2:
$q=mysql_query("select id,login,sex,dwl_files from users order by dwl_files desc;");
while($dbuser=mysql_fetch_array($q))
{
$users[] = '• <a href="'.$_SERVER['PHP_SELF'].'?mode=user&id='.$dbuser['id'].'&'.SID.'">'.$dbuser['login'].'</a> ('.($dbuser['sex']==2 ? 'скачала' : 'скачал').' '.$dbuser['dwl_files'].' файлов)<br/>';
}
$start = $_GET['start'];
$all = count($users);
$count = $all;
if(empty($start)) $start=0;
$start = intval($start);
if($start < 0)
$start=0;
if($count > $start + 15) $count = $start + 15;
for($i = $start;$i < $count;$i++)
{
print $users["$i"];
}
//////////////////////////////////////////////////////////////
$counter = count($users);
$max_mess=15;
$start= $_GET['start'];
if($counter>0){
$ba=ceil($start/$max_mess);
$ba2=$ba*$max_mess-$start;
$asd=$start-($max_mess*3);
$asd2=$start+($max_mess*15);
if($asd<$counter && $asd>0){echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=0&".SID.""> 1 </a> ... ";}
for($i=$asd; $i<$asd2;)
{
if($i<$counter && $i>=0){
$ii=floor(1+$i/$max_mess);
if ($start==$i) {
echo ''.$ii.'';
}
else {
echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=$i&".SID.""> [$ii] </a>";
}}
$i=$i+$max_mess;}
if($asd2<$counter){echo ' ... ';}
}
break;
case 3:
$q=mysql_query("select id,login,sex,upl_files_size from users order by upl_files_size desc;");
while($dbuser=mysql_fetch_array($q))
{
$users[] = '• <a href="'.$_SERVER['PHP_SELF'].'?mode=user&id='.$dbuser['id'].'&'.SID.'">'.$dbuser['login'].'</a> ('.($dbuser['sex']==2 ? 'залила' : 'залил').' '.formatsize($dbuser['upl_files_size']).')<br/>';
}
$start = $_GET['start'];
$all = count($users);
$count = $all;
if(empty($start)) $start=0;
$start = intval($start);
if($start < 0)
$start=0;
if($count > $start + 15) $count = $start + 15;
for($i = $start;$i < $count;$i++)
{
print $users["$i"];
}
//////////////////////////////////////////////////////////////
$counter = count($users);
$max_mess=15;
$start= $_GET['start'];
if($counter>0){
$ba=ceil($start/$max_mess);
$ba2=$ba*$max_mess-$start;
$asd=$start-($max_mess*3);
$asd2=$start+($max_mess*15);
if($asd<$counter && $asd>0){echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=0&".SID.""> 1 </a> ... ";}
for($i=$asd; $i<$asd2;)
{
if($i<$counter && $i>=0){
$ii=floor(1+$i/$max_mess);
if ($start==$i) {
echo ''.$ii.'';
}
else {
echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=$i&".SID.""> [$ii] </a>";
}}
$i=$i+$max_mess;}
if($asd2<$counter){echo ' ... ';}
}
break;
case 4:
$q=mysql_query("select id,login,sex,dwl_files_size from users order by dwl_files_size desc;");
while($dbuser=mysql_fetch_array($q))
{
$users[] = '• <a href="'.$_SERVER['PHP_SELF'].'?mode=user&id='.$dbuser['id'].'&'.SID.'">'.$dbuser['login'].'</a> ('.($dbuser['sex']==2 ? 'скачала' : 'скачал').' '.formatsize($dbuser['dwl_files_size']).')<br/>';
}
$start = $_GET['start'];
$all = count($users);
$count = $all;
if(empty($start)) $start=0;
$start = intval($start);
if($start < 0)
$start=0;
if($count > $start + 15) $count = $start + 15;
for($i = $start;$i < $count;$i++)
{
print $users["$i"];
}
//////////////////////////////////////////////////////////////
$counter = count($users);
$max_mess=15;
$start= $_GET['start'];
if($counter>0){
$ba=ceil($start/$max_mess);
$ba2=$ba*$max_mess-$start;
$asd=$start-($max_mess*3);
$asd2=$start+($max_mess*15);
if($asd<$counter && $asd>0){echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=0&".SID.""> 1 </a> ... ";}
for($i=$asd; $i<$asd2;)
{
if($i<$counter && $i>=0){
$ii=floor(1+$i/$max_mess);
if ($start==$i) {
echo ''.$ii.'';
}
else {
echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=$i&".SID.""> [$ii] </a>";
}}
$i=$i+$max_mess;}
if($asd2<$counter){echo ' ... ';}
}
break;
case 5:
$q=mysql_query("select id,login,sex,comments from users order by comments desc;");
while($dbuser=mysql_fetch_array($q))
{
$users[] = '• <a href="'.$_SERVER['PHP_SELF'].'?mode=user&id='.$dbuser['id'].'&'.SID.'">'.$dbuser['login'].'</a> ('.($dbuser['sex']==2 ? 'добавила' : 'добавил').' '.$dbuser['comments'].' комментариев)<br/>';
}
$start = $_GET['start'];
$all = count($users);
$count = $all;
if(empty($start)) $start=0;
$start = intval($start);
if($start < 0)
$start=0;
if($count > $start + 15) $count = $start + 15;
for($i = $start;$i < $count;$i++)
{
print $users["$i"];
}
//////////////////////////////////////////////////////////////
$counter = count($users);
$max_mess=15;
$start= $_GET['start'];
if($counter>0){
$ba=ceil($start/$max_mess);
$ba2=$ba*$max_mess-$start;
$asd=$start-($max_mess*3);
$asd2=$start+($max_mess*15);
if($asd<$counter && $asd>0){echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=0&".SID.""> 1 </a> ... ";}
for($i=$asd; $i<$asd2;)
{
if($i<$counter && $i>=0){
$ii=floor(1+$i/$max_mess);
if ($start==$i) {
echo ''.$ii.'';
}
else {
echo "<a href="index.php?mode=top&for=users&all&url=".htmlspecialchars($_GET['url'])."&start=$i&".SID.""> [$ii] </a>";
}}
$i=$i+$max_mess;}
if($asd2<$counter){echo ' ... ';}
}
break;
}
}
echo $separator;
echo $goback;
?>