View file games/down.php

File size: 5.36Kb
<?
include("modul/config.php"); include("modul/fun.php"); include("head.php");
echo '<div class=hre><img src=http://wap.sasisa.ru/games/img/k.gif> <a href=search.php>Поиск файлов</a><br></div><div class=hre><img src=http://wap.sasisa.ru/games/img/top.gif> <a href=top.php>Лучшие '.$nast['top'].' файлов</a><br></div>';  
echo "<div class=hre><img src=http://wap.sasisa.ru/games/img/r.gif> <a href=new.php>Новые  файлы</a><br></div>";
if(empty($sort)) { $mode='ORDER BY `timeupload` DESC'; } if($sort=="size") { $mode="ORDER BY `size` DESC"; } if($sort=="loads") { $mode="ORDER BY `loads` DESC"; } if($sort=="time") { $mode="ORDER BY `timeupload` DESC"; } if($sort=="name") { $mode="ORDER BY `name` ASC"; } 
$id=intval(zamena($_GET['id'])); 
if(!empty($id)) { $d=mysql_query("SELECT * FROM `files` WHERE `id`=$id");
$dat=mysql_fetch_array($d);
$coun=mysql_query('SELECT COUNT(*) FROM `files` WHERE `infolder`="'.mysql_real_escape_string($dat['path']).'"');  $count=mysql_result($coun,0);
$pages=ceil($count/$nast['onpage']); if(!$pages) $pages=1; if($page>$pages or $page<=0) $page=1; if($start>$count or $start<=0) $start=0; if($page) $start =($page-1)*$nast['onpage']; else $start=0;
echo ''.$dat['russname'].'/<br>';
echo "Сортировать по: <a href=down.php?id=$id&sort=size>размеру</a>|<a href=down.php?id=$id&sort=loads>популярности</a>|<a href=down.php?id=$id&sort=time>дате</a>|<a href=down.php?id=$id&sort=name>алфавиту</a><hr>";
if(!is_dir($dat['path'])) { echo 'Такого раздела не существует<br>'; }
$path=''.$dat['path'].'';
if($count<1){ echo '<b>[Раздел пуст]</b><br>'; }
$f=mysql_query('SELECT * FROM `files` WHERE `infolder`="'.$path.'" LIMIT '.$start.','.$nast['onpage'].''); while($file=mysql_fetch_array($f)) {
if(is_dir($file['path'])) { 
$day=$file['path']; $c=mysql_query("SELECT COUNT(*) FROM `files` WHERE `path` LIKE '$day%'"); $co=mysql_result($c,0); 
$time=time()-900; $ce=mysql_query("SELECT COUNT(*) FROM `files` WHERE `time`>$time and `path` LIKE '$day%'"); $ec=mysql_result($ce,0); if($ec<1) { $ec=''; } else { $ec='/+'.$ec.''; }
$co=$co-1;
echo '<div class=list><img src=image/015.png> <a href=down.php?sort='.$sort.'&id='.$file['id'].'>'.$file['russname'].'</a>('.$co.''.$ec.')<br>'; if(!empty($_COOKIE['pass'])){ echo '<a href=result.php?act=deldir&id='.$file['id'].'>удалить</a>|<a href=admin.php?act=dirname&id='.$file['id'].'>переимен.</a>|<a href=result.php?act=root&id='.$file['id'].'>сканер</a>|<a href=admin.php?act=copy&id='.$file['id'].'>копиров.</a>|<a href=admin.php?act=extract&id='.$file['id'].'&list=dir>запоков.</a></div>';  }
echo '</div>';
}
if(is_file(''.$file['infolder'].'/'.$file['name'].'')) { echo "<div class=hre>"; 
$cou=mysql_query('SELECT COUNT(*) FROM com WHERE `file_id`='.$file['id'].'');  $com=mysql_result($cou,0);
$ext=pathinfo($file['name'],PATHINFO_EXTENSION); if($ext=='jpg' or $ext=='gif' or $ext=='jpeg' or $ext=='png' or $ext=='bmp' or $ext=='tiff') { echo '<img src='.$file['infolder'].'/'.$file['name'].' height=60 width=50><br>'; }
if($file['time']>$nast['newfile']) { $new='<font color=red>NEW</font>'; }
echo ''.ext($ext).'<a href=view.php?id='.$file['id'].'>'.$file['name'].'</a> ('.size($file['size']).') |<a href=load.php?id='.$file['id'].'>Скачать</a> '.$new.'<br>Скачек: '.$file['loads'].' Ком: ('.$com['id'].')<br>'; if(mb_strlen($file['opis'],"UTF-8")>50) { $e="..."; } $opis=mb_substr($file['opis'],0,50,"UTF-8");  echo ''.$opis.''.$e.'<br>'; if(!empty($_COOKIE['pass'])){ echo '<a href=result.php?act=del&id='.$file['id'].'>удалить</a>|<a href=admin.php?act=rename&id='.$file['id'].'>переимен.</a>|<a href=admin.php?act=opis&id='.$file['id'].'>опис.</a>|<a href=admin.php?act=extract&id='.$file['id'].'&list=file>запоков.</a>|<a href=admin.php?act=per&id='.$file['id'].'>перемещ.</a>|<a href=admin.php?act=copy&id='.$file['id'].'&list=file>копир.</a>'; if($ext=="zip" and $ext=="sdt" and $ext=="nth"){  echo '|<a href=admin.php?act=extracts&id='.$file['id'].'>распок</a>'; } if($ext=="jpeg" or $ext=="jpg" or $ext=="png" or $ext=="gif"){ echo '|<a href=result.php?act=marker&id='.$da['id'].'>маркер</a>'; }}
echo '</div>';
}
}
if($count>$nast['onpage']){ echo '<br>'; $asd=$page-2; $asd2=$page+3; if($asd<$count && $asd>0 && $page>3) echo '<a href=down.php?id='.$dat['id'].'&sort='.$sort.'&page=1>1</a> ... '; for($i=$asd;$i<$asd2;$i++) { if($i<$count && $i>0) { if ($i>$pages) break; if($page==$i) echo '<strong>['.$i.']</strong>'; else echo '<a href=down.php?id='.$dat['id'].'&sort='.$sort.'&page='.$i.'>'.$i.'</a>'; } } if($i<=$pages) { if($asd2<$m) echo ' ... <a href=down.php?id='.$dat['id'].'&sort='.$sort.'&page='.$pages.'>'.$pages.'</a>'; } echo '<br>';  } 
$sta=$page*$nast['onpage']-$nast['onpage']; $total_files=$sta+1-$nast['onpage']; $max=$sta+$nast['onpage']-$nast['onpage']; if($max>$count){ $max=$count; } $sta=$page*$nast['onpage']-$nast['onpage']; $total_file=$sta+1+$nast['onpage']; $maxs=$sta+$nast['onpage']+$nast['onpage']; if($maxs>$count){ $maxs=$count; } 
if($page!=1) { echo '<a href=index.php?sort='.$sort.'&page='.($page-1).'><b>«'.$total_files.'-'.$max.'</b></a>'; }    if($page!=1 and $page<$pages) { echo ' | '; } if($page<$pages) { echo '<a href=index.php?sort='.$sort.'&page='.($page+1).'><b>'.$total_file.'-'.$maxs.'»</b></a><br>'; }  
}
include("foot.php");
?>