Файл: chat/index.php
Строк: 107
<?
include_once '../sys/includes/start.php';
include_once '../sys/includes/compress.php';
include_once '../sys/includes/sess.php';
include_once '../sys/includes/home.php';
include_once '../sys/includes/settings.php';
include_once '../sys/includes/db_connect.php';
include_once '../sys/includes/ipua.php';
include_once '../sys/includes/fnc.php';
include_once '../sys/includes/user.php';
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=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".intval($_GET['msg'])."' 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/includes/header.php';
title();
echo "<img src='/s-klub/img/eye-go.png'> <a href='/info.php?id=$ank[id]'>Посмотреть анкету</a><br />";
echo "<form method='post' action='/chat/room/".$room['id']."/".rand(1000,9999)."/'>";
echo "<img src='/s-klub/img/post-add.png'> <b>Сообщение:</b><br />";
echo "<textarea name='msg'>".$ank['nick'].", </textarea><br />";
echo "<label><input type='checkbox' name='privat' value='".$ank['id']."' /> Приватно</label><br />";
if ($user['set_translit']==1)
{
echo "<label><input type='checkbox' name='translit' value='1' /> Транслит</label><br />";
}
echo "<input value='Отправить' type='submit' />";
echo "</form>";
echo "<a href='/chat/room/$room[id]/".rand(1000,9999)."/'>";
echo "<div class='foot'>";
echo "<img src='/s-klub/img/left.png'> В комнату<br />";
echo "</div></a>";
echo "<a href='/chat/'>";
echo "<div class='foot'>";
echo "<img src='/s-klub/img/left.png'> Чат<br />";
echo "</div></a>";
include_once '../sys/includes/footer.php';
exit;
}
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/includes/header.php';
title();
include 'inc/room.php';
echo "<a href='/chat/'>";
echo "<div class='foot'>";
echo "<img src='/s-klub/img/left.png'> Чат<br />";
echo "</div></a>";
include_once '../sys/includes/footer.php';
exit;
}
$set['title']='Чат';
include_once '../sys/includes/header.php';
title();
auter();
include 'inc/admin_act.php';
err();
echo "<table class='post'>";
$q=mysql_query("SELECT * FROM `chat_rooms` ORDER BY `pos` ASC");
if (mysql_num_rows($q)==0)
{
echo "<tr>";
echo "<td class='err'>";
echo "Нет комнат!";
echo "</td>";
echo "</tr>";
}
while ($room = mysql_fetch_assoc($q))
{
echo "<tr>";
if ($set['set_show_icon']==2)
{
echo "<td class='icon48' rowspan='2'>n";
echo "<img src='/s-klub/img/big/chat.png'>";
echo "</td>n";
}
elseif ($set['set_show_icon']==1)
{
echo "<td class='icon14'>";
echo "<img src='/s-klub/img/small/chat.png'>";
echo "</td>";
}
echo "<td class='p_t'>";
echo "<a href='/chat/room/$room[id]/".rand(1000,9999)."/'>$room[name] (".mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `room` = '$room[id]'"),0).")</a>n";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='p_m' colspan='2'>";
if ($room['opis']!=NULL)
{
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($room['opis']))))))))."<br />";
}
if (user_access('chat_room'))
{
echo "<img src='/s-klub/img/set.png'> <a href='?set=$room[id]'>Параметры</a><br />";
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<a href='who.php'><div class='foot'>";
echo "<img src='/s-klub/img/eye-go.png'> Кто в чате?<br />";
echo "</div></a>";
include 'inc/admin_form.php';
include_once '../sys/includes/footer.php';
?>