<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';


$set['title']='Акции';
include_once '../sys/inc/thead.php';
title();
err();
aut();




$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `stock` WHERE `write`= 0"),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 "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "акций пока нет<br />";
echo "  </td>\n";
echo "   </tr>\n";
}

$res = mysql_query("select * from `stock`WHERE `write`=0 ORDER BY `time` DESC LIMIT $start, $set[p_str];"); 
while ($post = mysql_fetch_array($res)){


$ank=get_user($post['id_user']);
if($num==1){echo "<div class='rowup'>";$num=0;}else{echo "<div class='gmenu'>";$num=1;}

echo "<a href='stock.php?id=".$post['id']."'>".output_text($post['name'])."</a><br />\n";
echo "Время: ".vremja($post['time'])."<br/>\n";echo "Добавил: <a href='/info.php?id=$ank[id]'>$ank[nick]</a>";




echo "   </div>\n";
}

if ($k_page>1)str('?'.$dop.'',$k_page,$page); // Вывод страниц


if(isset($user))
{
if ($user[stock]==1)
{
echo'<div class="foot">';

echo "<a href=\"adds.php\">Добавить акцию</a><br />";
echo '</div>';
}


}

echo "<div class=foot> <a href='in.php'>Закрытые акции</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `stock` WHERE `write` = '1'"),0).")\n";
echo "<a href='list_mod.php'>Модераторы </a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `stock` = '1'"),0).")</div>\n";

include_once '../sys/inc/tfoot.php';

?>