<?

if (isset($ID)) {
  $ank = $sql -> fetch("SELECT * FROM `users` WHERE `id` = '$ID' LIMIT 1");
}

if (!isset($ank['id']) && isset($user)) {
  $ank = $user;
}


$system['title'] = 'Подписчики ' . login($ank['id'], 0);
require SYS . 'header.php';

$k_post = $sql -> selectCount("SELECT COUNT(*) FROM `shop_spy` WHERE `id_author` = '$ank[id]'");

if ($k_post == 0) {
  ?>
  <div class="alert" style="margin: 2px;">Список подписчиков пуст</div>
  <?
} else {
  $k_page = k_page($k_post, $system['page_str']);
  $page = page($k_page);
  $start =  $system['page_str'] * $page -  $system['page_str'];

  $array = $sql -> select("SELECT * FROM `shop_spy` WHERE `id_author` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, $system[page_str]");

  foreach ($array AS $contact) {
    $num++;
    ?>
    <div class="<?= ($num % 2 ? "nav1" : "nav2")?>">
      <?= avatar($contact['id_user'], 1)?> <?= login($contact['id_user'], 1)?><br /> 
      <i class="icon-shopping-cart"></i> <a href="?func=shop.seller&amp;id=<?= $contact['id_user']?>">Товары в магазине</a> (<?= $sql -> selectCount("SELECT COUNT(*) FROM `shop_goods` WHERE `id_user` = '$contact[id_user]' AND `unlink` = '0'")?>)
    </div>
    <?
  }

  if ($k_page > 1) { 
    str('?func=' . $func . '&amp;id=' . $ank['id'] . '&amp;', $k_page, $page);
  }
}
?>
<div class="foot">
&laquo; <a href="?func=user.profile&amp;id=<?= $ank['id']?>">На страницу</a><br />
</div>