 <?
 if(isset($_GET['InfoUser']) && intval($_GET['InfoUser'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets` WHERE `id_user` = '".intval($_GET['InfoUser'])."'"),0)!=0)
{
$ku['set'] = 5;
$post = mysql_fetch_array(mysql_query("SELECT * FROM `me_tikets` WHERE `id_user` = '".intval($_GET['InfoUser'])."'"));

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets` WHERE `id_user` = '".intval($_GET['InfoUser'])."' "),0);
if ($k_post==0)
{
echo "<div class='block'>Нет активных тикетов</div>";
}
$k_page=k_page($k_post,$ku['set']);
$page=page($k_page);
$start=$ku['set']*$page-$ku['set'];
$xx = mysql_query("SELECT * FROM `me_tikets` WHERE `id_user` = '".intval($_GET['InfoUser'])."' ORDER BY time DESC LIMIT $start, $ku[set]");
  echo'<div class="event"><h1>Информация о запросах</h1></div>';

while($tikets=mysql_fetch_assoc($xx)){
  echo "<div class='block'><a href='/?TicketSupport&id=$tikets[id]'>Тикет #$tikets[id]</a>";
echo "<br>";
echo " Автор: ID <a href='/?user=".($tikets['id_user'])."'>".($tikets['id_user'])."</a><br>[".vremja($tickets['time'])."]</div>";
}
if ($k_page>1){echo'</div>';
echo "<div class='block'>";}

if ($k_page>1)str("/?TicketInfo&InfoUser=".($tikets['id_user'])."&",$k_page,$page);
echo'</div>';
echo'</div></div>';
  include_once 'inc/foot.php';

}
//////////////////
if(isset($_GET['info']))
{
  echo'<div class="event"><h1>Переданные запросы</h1></div>';
$ku['set'] = 5;
$post = mysql_fetch_array(mysql_query("SELECT * FROM `me_tikets` WHERE `admin` = '1' AND `id_who` != '86'"));

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets` WHERE `admin` = '1' AND `id_who` != '86'"),0);
if ($k_post==0)
{
echo "<div class='block'>Нет переданных запросов</div>";
}
$k_page=k_page($k_post,$ku['set']);
$page=page($k_page);
$start=$ku['set']*$page-$ku['set'];
$xx = mysql_query("SELECT * FROM `me_tikets` WHERE `admin` = '1' AND `id_who` != '86' ORDER BY time DESC LIMIT $start, $ku[set]");

while($tikets=mysql_fetch_assoc($xx)){
  echo "<div class='block'><a href='/?TicketSupport&id=$tikets[id]'>Тикет #$tikets[id]</a>";
echo "<br>";
echo " Автор: ID <a href='/?user=".($tikets['id_user'])."'>".($tikets['id_user'])."</a><br>[".vremja($tickets['time'])."]</div>";
}
if ($k_page>1){echo'</div>';
echo "<div class='block'>";}

if ($k_page>1)str("/?TicketInfo&InfoUser=".($tikets['id_user'])."&",$k_page,$page);
echo'</div>';
echo'</div></div>';
  include_once 'inc/foot.php';

}
if(isset($_GET['history']))
{
  echo'<div class="event"><h1>История заявок</h1></div>';
$ku['set'] = 5;
$post = mysql_fetch_array(mysql_query("SELECT * FROM `me_tikets`"));

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets`"),0);
if ($k_post==0)
{
echo "<div class='block'>Нет  запросов</div>";
}
$k_page=k_page($k_post,$ku['set']);
$page=page($k_page);
$start=$ku['set']*$page-$ku['set'];
$xx = mysql_query("SELECT * FROM `me_tikets` ORDER BY time DESC LIMIT $start, $ku[set]");

while($tikets=mysql_fetch_assoc($xx)){
  echo "<div class='block'><a href='/?TicketSupport&id=$tikets[id]'>Тикет #$tikets[id]</a>";
echo "<br>";
echo " Автор: ID <a href='/?user=".($tikets['id_user'])."'>".($tikets['id_user'])."</a><br>[".vremja($tickets['time'])."]</div>";
}
if ($k_page>1){echo'</div>';
echo "<div class='block'>";}

if ($k_page>1)str("/?TicketInfo&InfoUser=".($tikets['id_user'])."&",$k_page,$page);
echo'</div></div>';
  include_once 'inc/foot.php';

}
if(isset($_GET['Support'])){
 echo'<div class="event"><h1>Тикеты</h1></div>'; 
  if($ku['id']==86){echo" <div class='block'><a href='/?TicketInfo&info'>Переданные заявки</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM me_tikets WHERE admin='1' AND id_who !='86'"), 0).")</div>";}
 echo" <div class='block'><a href='/?TicketInfo&history'>История заявок</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM me_tikets where id>'0'"), 0).")</div>";
 echo" <div class='block'><a href='/?TicketSupport&go'>Новые заявки</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM me_tikets WHERE msg_otvet=''"), 0).")</div>";

  echo'</div>';
  }
    include_once 'inc/foot.php';

?>