File size: 2.82Kb
<?php
$title='Топ файлов';
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";
echo'<div class="i">'.$title.'<br></div>';
if(isset($_GET['st'])){$st=cifry($_GET['st']);}else{$st=0;}
if(isset($_POST['str'])){$str=cifry($_POST['str']);}else{$str=0;}
if(!empty($str)){$st=$str*10-10;}
if(empty($st) or $st<0){$st=0;}
$num=10;
$ikm='file';
$adata=mysql_query("select * from down_files where typer='$ikm' limit 50");
$sdata=mysql_query("select * from down_files where typer='$ikm' order by prosm desc limit $st,$num");
$kol=mysql_num_rows($adata);
if($st>$kol){echo'Не верный номер страници'; require"../system/foot.php"; exit;}
if($kol==""){
echo'<div class="p">
ERROR<br>
</div>';
}else{
while($ofile=mysql_fetch_array($sdata)){
$sotg=time()-86400*3;
$newcolor=mysql_num_rows(mysql_query("SELECT * FROM `down_files` WHERE `dobav`>'$sotg' AND `typer`!='dir' AND `id_file`='".$ofile['id_file']."'")); $dokuda='../down/'.$ofile['put'].'/'.$ofile['nastna'].'.'.$ofile['format']; #Путь до файла
$vesma=round(filesize($dokuda)/1024); #Вес файла
if($vesma==0){$vesma='Менее 1';}
echo'<div class="p">';
if(empty($ofile['name'])){
$ofile['name']=$ofile['nastna'].'.'.$ofile['format'];
}
echo'<b>Имя:</b> <a href="'.$ofile['id_file'].'.info">'; if($newcolor==1){echo'<font color="red">';}
echo $ofile['name'];
if($newcolor==1){echo'</font>';}
echo'</a><br><b>Описание: </b>'; if($ofile['opis']==""){echo'нет';}else{echo mb_substr($ofile['opis'],0,200,'UTF-8');} echo'<br>
<small>Просмотров: '.$ofile['prosm'].'<br>
<small>Скачали: '.$ofile['loads'].' раз<br></small>
<a href="load.php?id_load='.$ofile['id_file'].'&'.$s.'">Скачать</a> ['.strtoupper($ofile['format']).'] ['.$vesma.'Кб]<br>
';
$koments=mysql_num_rows(mysql_query("select * from koments where type='downs' and id_kogo='".$ofile['id_file']."'"));
$koments=mysql_num_rows(mysql_query("select * from koments where type='downs' and id_kogo='".$ofile['id_file']."'"));
echo'<a href="../pages/koments.php?id_wm='.$ofile['id_file'].'&type=downs&'.$s.'">Комментарии</a> ['.$koments.']<br>
</div>';
}}
if($st!=0){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="top.php?st='.($st-$num).'&'.$s.'">Назад</a><br></div>';
}
if($kol>$st+$num){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="top.php?st='.($st+$num).'&'.$s.'">Вперед</a><br></div>';}
if($kol>10){
echo'<div class="p">
<form action="top.php?'.$s.'" method="post">
На страницу (1-'.ceil(($kol/10)).'):<br>
<input type="text" name="str" maxlength="4" class="form" size="3" value="'.ceil(($kol/10)).'">
<input type="submit" value="ОК" class="but"><br>
</form></div>';}
require"../system/foot.php";
?>