<?
require_once ('system/func.php');
$title = 'Подарки';
require_once ('system/header.php');
if(!$user) {header('location: /');exit;}

?>
<div class='wrapper'>

<div class='mb10'></div>
<div class='block_zero'>
<?
if(isset($_GET['id'])){$id=intval($_GET['id']);}else{$id=$user['id'];}


$set['p_str'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `prezents_us` WHERE `komy` = '".$id."' "),0);

$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
if($k_post == 0){ echo "<b>Подарков нет...</b>";}
else{

$q = mysql_query('SELECT * FROM `prezents_us` WHERE `komy` = '.$id.' ORDER BY `id` DESC LIMIT '.$start.' , '.$set['p_str'].'');
 while($row = mysql_fetch_array($q)) {
 
$us = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'" ')); 
echo'<img src="/images/gifts/'.$row['img'].'.png" alt=""/>От '.$us['login'].'<br>';
}
  
  
if ($k_page>1){
echo "<div class='dot-line'></div>";
str('?',$k_page,$page); // Вывод страниц
}  
}
echo'
<div class="line"></div>
</div>';

require_once ('system/footer.php');
?>