Файл: world-faces.ru/world-faces.ru/chat/inc/room.php
Строк: 167
<?
$_POST['msg'] = (isset($_POST['msg'])) ? htmlspecialchars(mysql_real_escape_string(trim($_POST['msg']))) : NULL;
if (isset($_POST['msg']) && isset($user))
{
$msg=htmlspecialchars(mysql_real_escape_string($_POST['msg']));
$_POST['translit'] = (isset($_POST['translit'])) ? htmlspecialchars(mysql_real_escape_string(trim($_POST['translit']))) : NULL;
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 `chat_post` WHERE `id_user` = '$user[id]' AND `msg` = '$msg' AND `time` > '".($time-300)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
else{
$msg=htmlspecialchars(mysql_real_escape_string($_POST['msg']));
$_POST['privat'] = (isset($_POST['privat'])) ? htmlspecialchars(mysql_real_escape_string(trim($_POST['privat']))) : NULL;
if(isset($_POST['privat']))
{
$priv=abs(intval($_POST['privat']));
}else{
$priv=0;
}
mysql_query("INSERT INTO `chat_post` (`id_user`, `time`, `msg`, `room`, `privat`) values('$user[id]', '$time', '$msg', '$room[id]', '$priv')");
mysql_query("UPDATE `user` SET `balls` = `balls`+10,`posts`=`posts`+1,`cel`=`cel`+1 WHERE `id` = '$user[id]' LIMIT 1");
msg('Сообщение успешно добавлено');
{
$n == 0;
for ( ; $n < count( $textbot ); ++$n )
{
$Line = each( $textbot );
if ( @eregi( @$Line[key], @$msg ) )
{
$rat_answ = $user[nick].", ".$Line[value]."";
mysql_query("INSERT INTO `chat_post` (`id_user`, `time`, `msg`, `room`, `privat`) values('106', '$time', '$rat_answ', '$room[id]', '0')");
break;
}
}
}
}
}
if ($room['umnik']=='1')include 'inc/umnik.php';
if ($room['shutnik']=='1')include 'inc/shutnik.php';
if ($room['barmen']=='1')include 'inc/barmen.php';
if ($room['fluder']=='1')include 'inc/fluder.php';
err();
// форма авторизации
mysql_query("DELETE FROM `chat_post` WHERE `time` < '".($time-3000)."'");
echo "<div class='menu'>";
echo "<a href='/chat/room/$room[id]/".rand(1000,9999)."/'>Обновить</a> | ";
echo "<a href='/smiles/'>Смайлы</a>";
if($room['barmen']==1) echo " | <a href='/chat/menubar.php?id=$room[id]'>Меню</a>n";
if (isset($user))
{
echo "<form method="post"<textarea cols='20' rows='3' name='message' action="/chat/room/$room[id]/".rand(1000,9999)."/"></textarea> 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 "<input name="msg" type="text" maxlength='200' value='' />n";
echo "<input value="Сказать" type="submit" />n";
echo "</form>n";
echo '<a href="/chat/index.php?id='.$room['id'].'&msg=0&vizov">Вызвать админа</a><br/>';
$vizov = (isset($_GET['vizov'])) ? htmlspecialchars(mysql_real_escape_string(trim($_GET['vizov']))) : NULL;
if(isset($vizov)){
$u = mysql_query("SELECT * FROM `user` WHERE `level`> '0' order by `date_last` DESC LIMIT 1");
while ($gl = mysql_fetch_array($u)){
$msg_t='Здравствуйте, обитатель [b]'.$user['nick'].'[/b] вызвал вас в комнату [url=/chat/room/'.$room['id'].'/'.rand(1000,9999).'/]'.$room['name'].'[/url]!';
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '".$gl['id']."', '$msg_t', '".time()."')");
$timer = intval($_SERVER['REQUEST_TIME']);
$msb="[b][url=/".$us['id']."]".$us['nick']."[/url][/b] вызвал".(($us['pol']==0)?'а':'')." вас в комнату [url=/chat/room/".$room['id']."/".rand(1000,9999)."/]".$room['name']."[/url]!";
mysql_query("INSERT INTO `op` (`id_us`,`msg`,`type`,`time`) values('$gl[id]', '$msb', 5,'$timer')");
echo'<div class="prof">Член администрации <b>'.$gl['nick'].'</b> получил ваш вызов, спасибо!</div>';
}
}
}
echo'</div>';
echo "<div class='p_m'>";
echo "В комнате";
$sql = mysql_query("SELECT `id_user` FROM `chat_who` WHERE `room` = '$room[id]'");
if ($sql==0){echo "Никого нетn";}
while($us = mysql_fetch_assoc($sql))
{
$login=mysql_fetch_array(mysql_query("select `nick`,`pol`,`ncolor` from `user` where `id`='".$us['id_user']."' limit 1;"));
echo ":<span style="color:$login[ncolor]"> $login[nick] </span> ";
}
echo'</div>';
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_post` WHERE `room` = '$room[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 "Нет сообщенийn";
}
$q=mysql_query("SELECT * FROM `chat_post` WHERE `room` = '$room[id]' AND (`privat`='0' OR `privat`='".$user['id']."') ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
if ($post['umnik_st']==0 && $post['shutnik']==0)
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
if($num==1){
echo "<div class='adm2'>";
$num=0;
}else{
echo "<div class='adm'>";
$num=1;}
if ($post['umnik_st']==0 && $post['shutnik']==0 && $post['barmen']==0)
echo "".online($ank['id'])." ";
elseif ($post['shutnik']==1)
echo "<img src='/style/themes/$set[set_them]/chat/14/shutnik.png' alt='' /> n";
elseif ($post['umnik_st']!=0)
echo "<img src='/style/themes/$set[set_them]/chat/14/umnik.png' alt='' /> n";
elseif($post['barmen']==1)
echo "<img src='/style/themes/$set[set_them]/chat/14/umnik.png' alt='' /> n";
if($post['privat']==$user['id'])
{
$Te6e_cyka='<font color="red">[Приват]</font>';
}else{
$Te6e_cyka='';
}
if ($post['umnik_st']==0 && $post['shutnik']==0 && $post['barmen']==0){
echo "<a href='/chat/room/$room[id]/".rand(1000,9999)."/$ank[id]/'><span style="color:$ank[ncolor]">$ank[nick]</span></a> ";
if ($ank['level']==1)echo "<span class="status"><font color = blue>(mod)</font></span>n";
elseif ($ank['level']==2)echo "<span class="status"><font color = green>(smod)</font></span>n";
elseif ($ank['level']==3)echo "<span class="status"><font color = red>(adm)</font></span>n";
elseif ($ank['level']==4)echo "<span class="status"><font color = red>(Создатель)</font></span>n";
echo "$Te6e_cyka (".vremja($post['time']).")n";
echo "<span style="color:$ank[color]">n";
echo bbcode(smiles(links($post['msg'])))."n";
if(isset($user) && $user['level']>3){
echo "<br/><a href='/chat/delete.php?id=$post[id]'>[<font color = red><b>x </b></font><font color = orange>удалить пост</font>]</a><br />n";
}
echo "</span>n";
echo'</div>';
}else{
if ($post['umnik_st']!=0)
echo "Умник (".vremja($post['time']).")n";
elseif ($post['shutnik']==1)
echo "Шутник (".vremja($post['time']).")n";
elseif ($post['barmen']==1)
echo "Бармен (".vremja($post['time']).")n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."n";
echo'</div>';
}}
if ($k_page>1)str("/chat/room/$room[id]/".rand(1000,9999)."/?",$k_page,$page); // Вывод страниц
?>