Файл: Zvanie/chat.php
Строк: 95
<?
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';
$set['title']='Чат';
include_once '../sys/inc/thead.php';
title();
aut();
?>
<style>
.logofon {
background-image: url('img/LOGOFON.png');
border-left: 0px solid black;
border-right: 0px solid black;
border-bottom: 0px solid black;
}
.nav1 {
background-image: url('img/razdel.png');
border-left: 0px solid black;
border-right: 0px solid black;
border-bottom: 0px solid black;
}
.nav2 {
background-image: url('img/f2.png');
border-left: 0px solid black;
border-right: 0px solid black;
border-bottom: 0px solid black;
}
.bank {
background-image: url('img/bank.png');
width:298px;
height:186px;
border-left: 0px solid black;
border-right: 0px solid black;
border-bottom: 0px solid black;
}
</style>
<?
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<?
echo '<div class="men"><div class="razdel2"><div class="fonlog"><img src="img/logokr.png" alt="" class="icon"/></div></div></div>';
if (isset($_POST['msg']))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)
{
$msg=translit($msg);
}
$mat=antimat($msg);
if ($mat)
{
$err='В сообщении обнаружен мат: '.$mat;
}
if (strlen2($msg)>=1025)
{
$err='Сообщение слишком длинное!';
}
if (strlen2($msg)<=2)
{
$err='Короткое сообщение!';
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `otrad_chat` WHERE `id_user` = '".$user['id']."' AND `msg` = '".my_esc($msg)."' LIMIT 1"),0)!=0)
{
$err='Ваше сообщение повторяет предыдущее!';
}
if (!isset($err))
{
mysql_query("INSERT INTO `otrad_chat` (id_user, time, msg) values ('".$user['id']."', '".$time."', '".my_esc($msg)."')");
msg('Сообщение успешно добавлено!');
}
}
err();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `otrad_chat`"),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 "<div class='err'>";
echo 'Нет сообщений!';
echo "</div>";
}
echo "<form method='post' name='message' action='?$passgen'>";
echo "<div class='nav2'>";
echo "<img src='img/strelka.png'> <b>Сообщение:</b><br />";
echo "<textarea name='msg'></textarea><br />";
if (isset($user) && $user['set_translit']==1)
{
echo "<label><input type='checkbox' name='translit' value='1' /> Транслит</label><br />";
}
echo "<input value='Написать' type='submit' />";
echo "</div>";
echo "</form>";
$q=mysql_query("SELECT * FROM `otrad_chat` ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post=mysql_fetch_assoc($q))
{
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='".$post['id_user']."' LIMIT 1"));
echo "<table style='width:100%' cellspacing='1' cellpadding='1'><tr>";
echo "<td class='nav1'>";
echo "<span style='float:right;'>";
echo "<b>".vremja($post['time'])."</b><br />";
echo "</span>";
echo "<img src='img/top.png' width='32'> ";
echo "<a href='/info.php?id=$ank[id]'><b>".$ank['nick']."</b></a> ";
echo "".online($ank['id'])."<br />";
echo "</td></tr>";
echo "<tr><td class='foot'>";
if ($user['level']>=4)
{
echo "<span style='float:right;'>";
echo "<a href='chat_del.php?id=$post[id]'><img src='img/delete.png'></a><br />";
echo "</span>";
}
echo "".output_text($post['msg'])."<br />";
echo "</td></tr>";
echo "</table>";
}
if ($k_page>1)
{
str('?',$k_page,$page);
}
echo "<div class='nav2'><a href='index.php'>";
echo "<img src='img/strelka.png'> <font color='red'><b>Назад</b></font><br />";
echo "</div></a>";
include_once '../sys/inc/tfoot.php';
?>