Файл: vfermu.ru/sys/home/chat.php
Строк: 62
<?
if(intval($_GET['chat'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `farm_chat` WHERE `id` = '".intval($_GET['chat'])."' AND `type` = 'room'".($ku['status']<=1?" AND `admod` = '0'":null).""),0)!=0)
{
$chat=mysql_fetch_array(mysql_query("SELECT * FROM `farm_chat` WHERE `id` = '".intval($_GET['chat'])."' AND `type` = 'room'"));
echo "<title>$chat[name]</title>";
echo "<div class='block'>";
echo '<div class="content"><ul>';
echo "<div><div><img alt='*' width='16' height='16' src='images/icons/refresh.png'> <a href='/chat-$chat[id]/".(rand(100000000,900000000))."'>Обновить</a>";
echo " <img width='16' height='16' src='images/icons/chat.png' alt='o'> <a href='?chat'>Чаты</a></div></div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `farm_chat` WHERE `type` = 'komm' AND `mother` = '$chat[id]'"),0);
if ($k_post==0)
{
echo "<li>пустo...</li>";
}
$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 `farm_chat` WHERE `type` = 'komm' AND `mother` = '$chat[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_array($q))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `farm_user` WHERE `id` = '$post[id_user]'"));
if($post['otvet']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `farm_user` WHERE `id` = '$post[otvet]'"),0)!=0)
{
$ot=mysql_fetch_array(mysql_query("SELECT * FROM `farm_user` WHERE `id` = '$post[otvet]'"));
}
$kuzens=$post['id'];
echo "<li class='pt'><span>";
echo on_k($ank['id']);
echo " <a class='' href='?user=$ank[id]'><span>".nc($ank['id'])."</span></a></span> <span class='minor small'> <span>".($time-$post['time']<=2592000?"".time_left($time-$post['time'])."</span> назад</span>":"".vremja($post['time'])."</span>")."</span></span></div><div class='title'><p>".(($post['otvet']!=0)?"".($ku['id']==$ot['id']?"<span class='rare'>":null)."$ot[nick]".($ku['id']==$ot['id']?"</span>":null).", ":null)."".output_text($post['msg'], $ank['id'], $kuzens)."</p></div><div>";
echo "</li>";
}
if ($k_page>1)str("?chat=$chat[id]&",$k_page,$page); // Вывод страниц
echo "</ul>";
echo "<li></li>";
echo "<li><img width='16' height='16' src='images/icons/chat.png' alt='o'> <a href='?chat'>Чаты</a></li>";
echo "</ul></div></div>";
include_once 'sys/home/end.php';
}
else
{
echo '<div class="content"><div class="block"><ul>';
$q=mysql_query("SELECT * FROM `farm_chat` WHERE `type` = 'room'".($ku['status']<=0?" AND `admod` = '0'":null)." ORDER BY `pos` ASC");
while($post=mysql_fetch_array($q))
{
echo "<li><div><img width='16' height='16' src='images/icons/chat.png' alt='o'> <a href='?chat=$post[id]'><span>".hsc($post['name'])."</span></a></div>".(strlen2($post['opis'])!=NULL?"<div class='minor small'>".hsc($post['opis'])."</div>":null)."";
echo "</li>";
}
echo "</ul>";
echo "</ul></div></div>";
?>
<title>Куда идем ? </title>
<?
include_once 'sys/home/end.php';
}
echo "</div>";
include_once "sys/home/end.php";
?>