Файл: vk.com_vhllam/klan/chat.php
Строк: 167
<?php
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/start.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/compress.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/sess.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/settings.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/db_connect.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/ipua.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/fnc.php';
require_once$_SERVER['DOCUMENT_ROOT'] . '/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();
include_once 'functions.php';
if (ban($user['id'], $id)) {
$us = mysql_fetch_array(mysql_query("SELECT * FROM `clan_user` WHERE `id_user` = '".$user['id']."' && `id_clan` = '$clan[id]' AND `activaty` = '0'"));
echo '<div class="mess"><b>Вы забанены в данном клане!</b><br /><b>Причина:</b> ' . $us['ban_prich'] . '<br /><b>Время окончания бана:</b> ' . vremja($us['ban_time']) . '</div>';
echo "<div class='aut'>";
echo "<a href='/klan/'>Все кланы</a><br/>n";
echo "<a href='/klan/rules.php'>Помощь и Правила</a>n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
exit();
}
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="err">n";
echo "Вы не состоите в кланеn";
echo "</div>n";
}
else
{
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_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_chat` (`id_user`, `time`, `msg`, `id_clan`) values('$user[id]', '$time', '$msg', '$clan[id]')");
########## Реётинг активности#################
mysql_query("UPDATE `user` SET `akt_rating` = '".($user['akt_rating']+0.009)."' WHERE `id` = '$user[id]' LIMIT 1");
########## Реётинг активности#################
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+3)."' WHERE `id` = '$user[id]' LIMIT 1");
msg('Сообщение успешно добавлено');
}
}
echo "<div class="menu"><a href='?act=chat&".rand(1000,9999)."'><b>Обновить чатик</b></a></div>n";
echo "<div class='page_foot'>";
include_once '../klan/who_chat.php';
echo "</div>n";
if (isset($user))
{
if (isset($_GET['reply'])) {
$reply = intval($_GET['reply']);
}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".intval($reply)."' LIMIT 1"));
$ank['nick'] = isset($ank['nick']) ? mysql_escape_string($ank['nick']).',' : '';
echo "<div class="mails"><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";
echo "<input value="Отправить" type="submit" />n";
echo "</form></div>n";
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `clan_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='mess'>n";
echo "Нет сообщенийn";
echo " </td>n";
echo " </tr>n";
}
$q=mysql_query("SELECT * FROM `clan_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='x1'>";
@$num=0;
}else{
echo "<div class='x2'>";
@$num=1;}
echo group($ank['id'])." <a href='/info.php?id=$ank[id]'><span style="color:$ank[ncolor]">$ank[nick]</span></a> [".vremja($post['time'])."]n";
if(isset($user) && $us['level']==2){
echo "<a href='adminka.php?act=delpost&id=$post[id_clan]&del=$post[id]'><font color = orange>DEL</font></a><br />n";
}
if(isset($user) && $us['level']==1){
echo "<a href='moderka.php?act=delpost&id=$post[id_clan]&del=$post[id]'><font color = orange>DEL</font></a><br />n";
}
echo "<br>n";
echo "<span style="color:#$ank[mcolor]">";
echo output_text($post['msg'])."n";
echo "</span><br />";
echo "<a href='?reply=$post[id_user]&".rand(1000,9999)."'>[Ответить]</a><br />n";
echo "</div>";
}
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
}
echo "<div class='aut'>";
if ($us['level'] > 0) {
if (isset($_GET['func']) && $_GET['func'] == 'clean_chat') {
if (empty($_GET['go'])) {
echo '<b>Вы уверены что хотите очистить чат полностью?</b><br />';
echo '<a href="chat.php?id='.$id.'&func=clean_chat&go=yes">[Да]</a> <a href="chat.php?id='.$id.'">[Нет]</a><br /><br />';
} else {
mysql_query("DELETE FROM `clan_chat` WHERE `id_clan` = '$clan[id]'");
header("location: chat.php?id=".$id);
}
}
echo "<a href='chat.php?func=clean_chat'><b>[Очистить чат]</b></a><br/>n";
}
echo "<a href='/klan/myklan.php'>Мой клан</a><br/>n";
echo "<a href='/klan/'>Все кланы</a><br/>n";
echo "<a href='/klan/rules.php'>Помощь и Правила</a>n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
?>