<?
if ($level < 3){
  header('Location: /index.php');
  exit;
}

$system['title'] = 'Товары на удаление';
require SYS . 'header.php';

$k_post = $sql -> selectCount("SELECT COUNT(*) FROM `shop_goods` WHERE `unlink` = '1'");

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_goods` WHERE `unlink` = '1' ORDER BY `id` DESC LIMIT $start, $system[page_str]");

  foreach ($array AS $post) {
    $num++;
    ?>
    <div class="<?= ($num % 2 ? "nav1" : "nav2")?>">
      <a href="?func=shop.goodsdelete&amp;id=<?= $post['id']?>" class="close">&times;</a>
      <a href="?func=shop.goods&amp;id=<?= $post['id']?>"><?= text($post['name'])?></a> <br />
    </div>
    <?
  }

  if ($k_page > 1) { 
    str('?func=' . $func . '&amp;', $k_page, $page);
  }
}
?>