Файл: test.masteram.us/besedka/inc/room.php
Строк: 182
<?
$ank1=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (!empty($_POST['bold'])){
$msg = '[b]'.$msg.'[/b]';}
if (!empty($_POST['under'])){
$msg = '[u]'.$msg.'[/u]';}
if (!empty($_POST['color'])){
$msg = '[color='.$_POST['color'].']'.$msg.'[/color]';}
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>512){$err=''.$ln['err'].'';}
elseif (strlen2($msg)<2){$err=''.$ln['err'].'';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `besedka_post` WHERE `id_user` = '$user[id]' AND `msg` = '".mysql_escape_string($msg)."' AND `time` > '".($time-2000)."' LIMIT 1"),0)!=0){$err=''.$ln['err'].'';}
else{
$msg=mysql_escape_string($msg);
if(isset($_POST['privat']))
{
$priv=abs(intval($_POST['privat']));
}else{
$priv=0;
}
mysql_query("INSERT INTO `besedka_post` (`id_user`, `time`, `msg`, `room`, `privat`) values('$user[id]', '$time', '$msg', '$room[id]', '$priv')");
mysql_query("UPDATE `user` SET `lafes_g` = '".($user['lafes_g']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."', `akt_rating` = '".($user['akt_rating']+0.001)."' WHERE `id` = '$user[id]' LIMIT 1");
msg(''.$ln['good'].'');
}
}
if ($room['umnik']=='1')include 'inc/umnik.php';
if ($room['shutnik']=='1')include 'inc/shutnik.php';
if ($room['bot']=='1')include 'inc/bot.php';
err();
echo "<div class='tmn'>";
echo "online";
$sql = mysql_query("SELECT `id_user` FROM `chat_who` WHERE `room` = '$room[id]'");
if ($sql==0){echo ''.$ln['null'].'';}
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]</a> </span> ";
}
echo'</div>';
echo '<div class="textmes">';
echo "<img src='/style/pic/reload.png' /> <a href='/besedka/room/$room[id]/".rand(1000,9999)."/'><font color='black'>+</font></a> | <a href='/smiles/index.php'><font color='black'>:)</font></a>n";
//////////////
include_once '../bb.php';
/////////////
if (isset($user))
{
echo "<form method="post" name='message' action="/besedka/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='' /><br/>n";
echo "<textarea name="msg"></textarea><br/>n";
#if($user['group_access'] > 1){
#echo "<label><input type="checkbox" name="bold" value="$user[id]" /> <b>Aa</b></label>n";
#echo "<label><input type="checkbox" name="under" value="$user[id]" /> <u>Bb</u></label><br />n";}
echo "<input value="OK" type="submit" /><br/>n";
echo "</form>n";
echo '</div>';
echo '</div>';
}
$set['p_str'] = 15;
$k_post=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `besedka_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 " <tr>n";
echo ''.$ln['null'].'';
}
$q=mysql_query("SELECT * FROM `besedka_post` WHERE `room` = '$room[id]' AND (`privat`='0' OR (`privat`='".$user['id']."' OR `id_user`='".$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 && $post['bot']==NULL)
$ank=get_user($post['id_user']);
if($num==1){
echo "<div class='linechat'>";
$num=0;
}else{
echo "<div class='linechat'>";
$num=1;}
if($post['privat'])
{
$Te6e_cyka='<font color="darkred">[!п]</font>';
$privat = '?priv=1';
}else{
$Te6e_cyka='';
$privat = '';
}
if (user_access('chat_clear'))
{
echo "<a href='/besedka/delete.php?id=$post[id]'><img src='/style/icons/del.gif'></a>n";
}
if ($post['umnik_st']==0 && $post['shutnik']==0 && $post['bot']==NULL)
echo "".online($ank['id'])." <a href='/besedka/room/$room[id]/".rand(1000,9999)."/$ank[id]/'><span style="color:$ank[ncolor]">$ank[nick]</span></a>$Te6e_cyka</a>n";
if ($ank['priz']>1)echo "<img src='/style/back.gif'>n";
if ($ank['obit']==0)
{
if ($ank['group_access']>1)echo "<img src='/img/online/$ank[pol].png'>n";
///if ($ank['group_access']>1)echo "<img src='/style/adm.png'>n";
}
if ($ank['status_vip']==1)echo " <img src='/status_vip/img/vip.gif'<br />";
if($ank['akt_rating']>=0 && $ank['akt_rating']<=1.000)echo " ";
if($ank['akt_rating']>=1.001 && $ank['akt_rating']<=2.500)echo " <img src='/style/rating/bronze.gif'></img> ";
if($ank['akt_rating']>=2.501 && $ank['akt_rating']<=5.000)echo " <img src='/style/rating/silver.gif'></img> ";
if($ank['akt_rating']>=5.001 && $ank['akt_rating']<=7.500)echo " <img src='/style/rating/gold.gif'></img> ";
if($ank['akt_rating']>=7.501 && $ank['akt_rating']<=10.000)echo " <img src='/style/rating/lafes_user.gif'></img> ";
if($ank['akt_rating']>=10.001 && $ank['akt_rating']<=200.000)echo " <img src='/rating/konkurs.png'></img> ";
echo "<font color='#afb0a3'>(".vremja($post['time']).")</font><br/>n";
echo "<span style="color:$ank[mcolor]">";
echo str_replace($user['nick'],"<b><span style="color:$user[ncolor]">".$user['nick']."</span></b>",esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg'])))))))))."n";
echo "</span>n";
echo "</div>n";
}
if ($k_page>1)str("/besedka/room/$room[id]/".rand(1000,9999)."/?",$k_page,$page); // Вывод страниц
echo "<div class='menu_razd'>";
echo "<img src='/style/icons/top10.png' alt='' class='icon'/> <a href='/top/besedka_top10.php'>top 10</a><br/>";
$k_p=mysql_result(mysql_query("SELECT COUNT(*) FROM `besedka_post`",$db), 0);
$k_n= mysql_result(mysql_query("SELECT COUNT(*) FROM `besedka_post` WHERE `time` > '".(time()-86400)."'",$db), 0);
if ($k_n==0)$k_n=NULL;
else $k_n='+'.$k_n;
echo "<img src='/style/icons/edit.gif' alt='' class='icon'/> total <font color='red'>$k_p</font>";
echo "</div>n";
echo "</div>n";
include_once '../foot.php';
?>