Файл: promotion/show.php
Строк: 122
<?
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();
if (!isset($_GET['id']) && !is_numeric($_GET['id'])){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `promotion` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1",$db), 0)==0){header("Location: index.php?".SID);exit;}
$post=mysql_fetch_array(mysql_query("select * from `promotion` where `id`='".intval($_GET['id'])."';"));
if (($user['level'] <2) && ($user['id'] !=$post['id_user']))
{
echo'доступ закрыт';
include_once '../sys/inc/tfoot.php';
exit();
}
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
$msg=mysql_real_escape_string($_POST['msg']);
if (strlen2($msg)>1024){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<2){$err='Короткое сообщение';}
else{
mysql_query("INSERT INTO `otvet_tiket` (`id_user`, `time`, `msg`, `id_tiket`) values('$user[id]', '$time', '".mysql_real_escape_string($msg)."', '".intval($_GET['id'])."')");
$msg="Вы получили ответ на Ваш тикет [url=/promotion/show.php?id=$post[id]]перейти[/url]";
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '0', '$msg', '$time')");
}
}
err();
aut(); // форма авторизации
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `otvet_tiket` WHERE `id_tiket` = '".intval($_GET['id'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `otvet_tiket` WHERE `id_tiket` = '".intval($_GET['id'])."' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_assoc($q))
{
$ank=get_user($post['id_user']);
echo " <tr>n";
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>n";
avatar($ank['id']);
echo " </td>n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>n";
echo " </td>n";
}
if($ank[mod]==1){echo" <b>Администратор тикетов</b>";}else{
echo "<a href='/info.php?id=$ank[id]'><span style="color:$ank[color]">$ank[nick]</span></a>";}echo" (".vremja($post['time']).")n";
echo " </br>n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."<br />n";
echo "</span>";
echo"<div class=p_t></div>n";
echo " </td>n";
echo " </tr>n";
}
$post=mysql_fetch_array(mysql_query("select * from `promotion` where `id`='".intval($_GET['id'])."';"));$ank=get_user($post['id_user']);echo "<a href='/info.php?id=$ank[id]'><span style="color:$ank[color]">$ank[nick]</span></a> (".vremja($post['time']).")n";echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."<br />n";
echo "</table>n";
if ($k_page>1)str("?id=".intval($_GET['id']).'&',$k_page,$page); // Вывод страниц
echo"<div class=p_t></div>n";
if($post['all'] != 0){
if (isset($user))
{
echo "<form method="post" name='message' action="?id=".intval($_GET['id'])."&page=$page">n";
if ($set['web'] && is_file(H.'style/themes/'.$set['set_them'].'/altername_post_form.php'))
include_once H.'style/themes/'.$set['set_them'].'/altername_post_form.php';
else
echo "Сообщение:<br />n<textarea name="msg"></textarea><br />n";
echo "<input value="Отправить" type="submit" />n";
echo "</form>n";
}
}
else
{
echo"Тикет закрыт";
}
if (($user['mod']==1)){echo"<div class=foot><a href=admin_set.php?id=$post[id]>Настройки</a><div>";}
include_once '../sys/inc/tfoot.php';
?>