Файл: public_html/klan/adm_panel/adm_chat.php
Строк: 144
<?
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';
$us = mysql_fetch_array(mysql_query("SELECT * FROM `clan_user` WHERE `id_user` = '$user[id]' LIMIT 1"));
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '$us[id_clan]' LIMIT 1"));
$set['title'] = 'Чат клана '.$clan['name'];
include_once '../../sys/inc/thead.php';
title();
aut();
echo "<div class='p_t'><center><img src='/klan/img/01.png'/></center></div>";
if (mysql_result(mysql_query("SELECT COUNT(id) FROM `clan_user` where `id_user` = '$user[id]' AND `activaty` = '0' LIMIT 1"),0)==0){
echo "<div class="str">n";
echo "Вы не состоите в кланеn";
echo "</div>n";
}else{
if($us['level']>0){
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>512){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<2){$err='Короткое сообщение';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_adm_chat` WHERE `id_user` = '$user[id]' AND `id_clan` = '$clan[id]' AND `msg` = '".mysql_escape_string($msg)."' AND `time` > '".($time-300)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
else{
$msg=mysql_escape_string($msg);
mysql_query("INSERT INTO `clan_adm_chat` (`id_user`, `time`, `msg`, `id_clan`) values('$user[id]', '$time', '$msg', '$clan[id]')");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
msg('Сообщение успешно добавлено');
}
}
echo "<div class='p_s'><b><a href='?act=chat&".rand(1000,9999)."'>Обновить</a>|<a href='/smiles/'>Смайлы</a>|<a href='/bb_code.php'>Теги</a>|</b></div><div class='p_m'>n";
if (isset($user))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".intval($_GET['reply'])."' LIMIT 1"));
$ank['nick'] = isset($ank['nick']) ? mysql_escape_string($ank['nick']).',' : '';
echo "<form method="post" name='message' action="?act=chat">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">$ank[nick]</textarea><br />n";
if ($user['set_translit']==1)echo "<label><input type="checkbox" name="translit" value="1" /> Транслит</label><br />n";
echo "<input value="Отправить" type="submit" />n";
echo "</form></div><div class='p_t'><hr/></div>n";
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_adm_chat` WHERE `id_clan` = '$clan[id]'"),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_m'>n";
echo "Нет сообщенийn";
echo " </td>n";
echo " </tr>n";
}
$q=mysql_query("SELECT * FROM `clan_adm_chat` WHERE `id_clan` = '$clan[id]' ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
if(@$num==1){
echo "<div class='p_m'>";
@$num=0;
}else{
echo "<div class='p_t'>";
@$num=1;}
echo online($ank['id'])." <a href='/info.php?id=$ank[id]'><b><span style="color:$ank[ncolor]">$ank[nick]</b></span></a> (".vremja($post['time']).")n";
echo "</br><span style="color:$ank[color]">n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."n";
echo "</span></br></br>n";
echo "<a href='?reply=$post[id_user]&".rand(1000,9999)."'>Ответить</font></a> ";
if(isset($user) && $us['level']>=1){
echo " | <a href='delpost.php?id=$post[id_clan]&del=$post[id]'>Удалить</font></a><br />n";
}
echo "<div class='menu_razd'><center>.....................</center></div>n";
echo "</div>";
}
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
}else{
echo "<div class='p_m'>n";
echo "Вы не являетесь членом админ состава данного клана!n";
echo "</div>n";
}
}
include '../inc/foot.php';
include_once '../../sys/inc/tfoot.php';
?>