<?
include '../config.php';
include '../func.php';

head();
aut();
ban();
////////////////////////////////////////
mysql_query("UPDATE `profile` SET `online` = 'fo' WHERE `id` = '".$id_session."'");

if ( isset($_GET['addcyes']) ) echo katalog . 'Подкаталог успешно создан' . div;

$id = num($_GET['user']);
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `profile` WHERE `id` = '".$id."'"));


echo head . "<b>Обменник файлов / Файлы ".$user['login']."</b>" . div;   
echo katalog;

$all = mysql_result(mysql_query("SELECT count(*) FROM fo_fil WHERE `user` = '".$user['id']."'"), 0);

if ( $all == 0 ) {
    
    echo 'Файлы еще не загружены';
} else {

if($all){
$onpage = 5;
$allpage = ceil($all/$onpage);
$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$start = $this_page*$onpage - $onpage;

$result = mysql_query("SELECT * FROM fo_fil WHERE `user` = '".$user['id']."' order by id desc limit ".num($start).",".num($onpage)."");
while($file = mysql_fetch_assoc($result)){

if ( $cat['tip'] == 1 ) {
    echo "<img src=\"../pict.php?file=newobmen/files/".$file['file']."\" alt=\".\" /><br/>";
} else {

if ( !empty($file['screen']) ) {
    
    echo "<img src=\"../pict.php?file=newobmen/screen/".$file['screen']."\" alt=\".\" /><br/>";
} else {
    echo 'Без скриншота<br/ >';
}

}
$f = 'files/'.$file['file'];
echo '<a href="view.php?file='.$file['id'].'">'.$file['name'].'</a> ('.size(filesize($f)).')<hr>';
}

echo '<b>Страницы:</b> ';
navigation($allpage,"usfiles.php?user=".$pcat['id']."&p={p}",1,1);
}

}




echo div;
/////////////////////////////////////////

navig();
foot();
?>