Файл: chat/index.php
Строк: 170
<?
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';
/* Бан пользователя */
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'chat' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
header('Location: /ban.php?'.SID);exit;
}
if (isset($user))mysql_query("DELETE FROM `chat_who` WHERE `id_user` = '$user[id]'");
mysql_query("DELETE FROM `chat_who` WHERE `time` < '".($time-120)."'");
if (isset($user) && isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_rooms` WHERE `id` = '".intval($_GET['id'])."'"),0)==1
&& isset($_GET['msg']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['msg'])."'"),0)==1)
{
$room=mysql_fetch_assoc(mysql_query("SELECT * FROM `chat_rooms` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
$ank=get_user(intval($_GET['msg']));
if (isset($user))mysql_query("INSERT INTO `chat_who` (`id_user`, `time`, `room`) values('$user[id]', '$time', '$room[id]')");
if ($set['time_chat']!=0)header("Refresh: $set[time_chat]; url=/chat/room/$room[id]/".rand(1000,9999).'/'); // автообновление
$set['title']='Чат - '.$room['name'].' ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `room` = '$room[id]'"),0).')'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
echo "<form class='main' method="post" action="/chat/room/$room[id]/".rand(1000,9999)."/">n";
echo "<textarea name="msg">$ank[nick], </textarea><br />n";
echo "Ответ доступен: ";
echo "<select name='privat'>";
echo "<option value='0'>Всем</option>";
echo "<option value='".$ank['id']."'>Приватно</option>";
echo "</select>";
if ($user['set_translit']==1)echo "<br/><label><input type="checkbox" name="translit" value="1" /> Транслит</label><br />n";
echo "<input value="Сказать" type="submit" />n";
echo "<br/><span class='right'><a href='/plugins/smiles/'><span style='color:#006666;'>Смайлы</span></a> | n ";
echo "<a href='/plugins/rules/bb-code.php'><span style='color:#006666;'>Теги</span></a></span><br/>n";
echo "</form>n";
echo "<div class="main">n";
echo "<a href='/id".$ank['id']."'>Сайт ".$ank['nick']."</a><br/>n";
echo "<a href='/user/info/anketa.php?id=".$ank['id']."'>Анкета ".$ank['nick']."</a><br/>n";
echo "</div><div class='main'>n";
echo "<a href='/mail.php?id=".$ank['id']."'><img src='/style/icons/new_mail.png'> Сообщение ".$ank['nick']."</a></div>n<div class='foot'>";
echo " <img src='/style/icons/str2.gif' alt='*'> <a href="/chat/room/$room[id]/".rand(1000,9999)."/">В комнату</a><br />n";
echo " <img src='/style/icons/str2.gif' alt='*'> <a href="/chat/">Прихожая</a><br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
}
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_rooms` WHERE `id` = '".intval($_GET['id'])."'"),0)==1)
{
$room=mysql_fetch_assoc(mysql_query("SELECT * FROM `chat_rooms` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
if (isset($user))mysql_query("INSERT INTO `chat_who` (`id_user`, `time`, `room`) values('$user[id]', '$time', '$room[id]')");
if ($set['time_chat']!=0)header("Refresh: $set[time_chat]; url=/chat/room/$room[id]/".rand(1000,9999).'/'); // автообновление
$set['title']='Чат - '.$room['name'].' ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `room` = '$room[id]'"),0).')'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
include 'inc/room.php';
echo "<div class="foot">n";
echo "<img src='/style/icons/str2.gif' alt='*'> <a href="/chat/">Прихожая</a><br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
}
$set['title']='Чат - прихожая'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
include 'inc/admin_act.php';
err();
aut(); // форма авторизации
echo "<table class='post'>n";
$q=mysql_query("SELECT * FROM `chat_rooms` ORDER BY `pos` ASC");
if ( mysql_num_rows($q) == 0 ) {
echo " <div class='mess'>n";
echo "Нет комнатn";
echo " </div>n";
}
while ($room = mysql_fetch_assoc($q))
{
/*-----------зебра-----------*/
if ($num==0){
echo '<div class="nav1">';
$num=1;
}elseif ($num==1){
echo '<div class="nav2">';
$num=0;
}
/*---------------------------*/
echo " <a href='/chat/room/$room[id]/".rand(1000,9999)."/'>".text($room['name'])." <span style='color:darkmagenta;'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `room` = '$room[id]'"),0).")</span></a> n";
if (user_access('chat_room'))echo " <span style='float:right;'><a href='?set=".$room['id']."'><img src='/style/icons/edit_info.png' alt='*' /></a></span> n";
if ($room['opis']!=NULL)echo '<br />'.esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($room['opis']))))))))."<br />n";
echo " </div>n";
}
echo "</table>n";
echo "<div class="foot">n";
echo "<a href='who.php'><img src='/style/icons/about.gif' alt='*'> Кто в чате?</a><br />n";
echo "<a href='/user/admin.user.php?chat'><img src='/style/user/mod_man_on.gif'> Модераторы</a>";
echo "</div>n";
include 'inc/admin_form.php';
include_once '../sys/inc/tfoot.php';
?>