Файл: minichat_by_KoT/minichat_by_KoT/room.php
Строк: 81
<?php
##########################################
# ~ Разработка отдельных модулей ~~~~~~~ #
# ~ и написание скриптов на php (c)KoT ~ #
# ~ ICQ: 7675072 ~~~~~~~~~~~~~~~~~~~~~~~ #
# ~ Site: 4atlove.ru ~~~~~~~~~~~~~~~~~~~ #
# ~ E-mail: notefree@bk.ru ~~~~~~~~~~~~~ #
##########################################
require 'sid.php';
header("Cache-Control: no-cache");
header('Content-Type:text/html; charset=UTF-8');
require 'config.php';
$link = connect_db();
list($row, $id, $ps) = check_login($link);
require 'pages.php';
if (!ctype_digit($_GET['rm']))
{
header('Location: index.php?isset=403');
die;
}
$rm = (int)$_GET['rm'];
whorm($rm, "$rm");
if (isset($_GET['del']))
{
if ($row['level'] == 2)
{
mysql_query("DELETE FROM `message` WHERE `rm`='$rm'");
}
}
$rooms = mysql_fetch_array(mysql_query("SELECT * FROM `rooms` WHERE `rm`='$rm'"));
if (mysql_affected_rows() == 0)
{
include 'head.php';
echo $bad . 'Такой комнаты не существует!' . $div5;
echo $div3 . '<a href="menu.php?'.$ref.'"><b>В меню</b></a>' . $div5;
include 'foot.php';
exit();
}
echo '<title>'.$rooms['topic'].'-'.date("H:i", $time).'</title>';
include_once 'head.php';
$ASnum = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `room`='$rm' AND `onl` + 100 > '$time' ORDER BY `onl` DESC"));
echo $div1 . '<a href="whois.php?rm='.$rm.'"/>Здесь('.($ASnum).')</a>
|
<a href="smile/index.php?rm='.$rm.'"/>Смайлы</a> ';
if ($row['level'] == 2) {
echo '|
<a href="top.php?rm='.$rm.'"/>Сменить топ</a>
|
<a href="room.php?rm='.$rm.'&del"/>Очистить</a>';
}
echo $div5 . $div3 . '
<a href="room.php?rm='.$rm.'&refresh"><b>Обновить</b></a>|<a href="add.php?rm='.$rm.'&act"><b>Сказать</b></a><hr/>' . $block;
if (isset($_GET['refresh']))
{
header ('Location: room.php?rm='.$rm.'');
}
if (empty($row['max'])) $row['max'] = 10;
$max = $row['max'];
$smset = $row['smiles'];
$avr = $row['avr'];
$avr2 = $avr / 10;
if ($avr == 0) echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>';
else echo '<META HTTP-EQUIV="Refresh" CONTENT="'.$avr2.'"; URL=room.php?rm='.$rm.'">';
$k_post = mysql_result(mysql_query("SELECT count(*) FROM `message` WHERE `rm`='$rm' AND `inps`='$inps'"),0);
$k_page = k_page($k_post, $max);
$page = page($k_page);
$start = $max * $page - $max;
if ($k_post == 0) echo 'Сообщений пока нету...<br/>';
if (isset($_GET['err']) && $_GET['err'] == 't') echo $bad . 'Не флуди, интервал 10 сек.' . $div5 . $block;
if (isset($_GET['err']) && $_GET['err'] == 'p') echo $bad . 'Слишком короткое сообщение!' . $div5 . $block;
if (isset($_GET['err']) && $_GET['err'] == 'c') echo $bad . 'Ваши сообщения повторяются!' . $div5 . $block;
if (isset($_GET['delete']))
{
if ($row['level'] == 2)
{
mysql_query("DELETE FROM `message` WHERE `id`='".(int)$_GET['delete']."'");
echo $good . 'Сообщение удалено!' . $div5 . $block;
} else {
echo $bad . 'Сообщение не удалено!' . $div5 . $block;
}
}
if ($rm == 1) require 'umnik1.php';
$mess = mysql_query("SELECT * FROM `message` WHERE `rm`='$rm' AND `inps`='$inps' ORDER BY `id` DESC LIMIT ".abs(intval($start)).", ".abs(intval($max))."");
while($msg = mysql_fetch_assoc($mess))
{
$text = $msg['msg'];
if ($msg['color'] == 0) $text = $text;
elseif ($msg['color'] == 1) $text = '<font color="#0000FF">'.$text.'</font>';
elseif ($msg['color'] == 2) $text = '<font color="#FF0000">'.$text.'</font>';
elseif ($msg['color'] == 3) $text = '<font color="#309d0e">'.$text.'</font>';
elseif ($msg['color'] == 4) $text = '<font color="#80FF00">'.$text.'</font>';
elseif ($msg['color'] == 5) $text = '<font color="#00FFFF">'.$text.'</font>';
elseif ($msg['color'] == 6) $text = '<font color="#FF8000">'.$text.'</font>';
elseif ($msg['color'] == 7) $text = '<font color="#C0C0C0">'.$text.'</font>';
elseif ($msg['color'] == 8) $text = '<font color="#FF00FF">'.$text.'</font>';
elseif ($msg['color'] == 9) $text = '<font color="#000000">'.$text.'</font>';
if ($msg['font'] == 1) $text = '<i>' . $text . '</i>';
elseif ($msg['font'] == 2) $text = '<u>' . $text . '</u>';
elseif ($msg['font'] == 3) $text = '<i><u>' . $text . '</u></i>';
elseif ($msg['font'] == 4) $text = '<b>' . $text . '</b>';
elseif ($msg['font'] == 5) $text = '<u><b>' . $text . '</b></u>';
elseif ($msg['font'] == 6) $text = '<big><b>' . $text . '</b></big>';
elseif ($msg['font'] == 7) $text = font($text);
// Если пользователь заражен бешенством
if ($row['gameid'] == 6 && $row['gamekik'] > $time && time() - 15 > $_SESSION['last']) {
$be = mt_rand(1,9);
$be = str_replace(1, 'бля всех убъю нах...', $be);
$be = str_replace(2, 'сука вон нахуй бля бля..', $be);
$be = str_replace(3, 'хуй нахуй похуй хули хуюшки хуяк )', $be);
$be = str_replace(4, 'ебать мой нежный хуй', $be);
$be = str_replace(5, 'все гандоны бляяяяя', $be);
$be = str_replace(6, 'пидарасы бешенством заразили ррр..', $be);
$be = str_replace(7, 'ебись оно конем бля!', $be);
$be = str_replace(8, 'ебать тарахтеть нах...', $be);
$be = str_replace(9, 'ска бля пздц нах ахуеть ни фстать аднака..', $be);
$text = $be;
$today = date("H:i:s");
mysql_query("INSERT INTO `message` (`user`,`user_id`,`time`,`msg`,`rm`,`color`) VALUES ('$row[user]','$row[id]','$today','$text','$rm','$row[cvet]')");
$_SESSION['last'] = time();
}
$text = smiles($text);
if ($row['translit'] == 1) $text = trun_to_rus($text);
if ($msg['komu'] != 0)
{
if ($row['id'] == $msg['komu']) $komu = '<b>'.user_inf($msg['komu'], 'user').'</b>, ';
else $komu = '<u>'.user_inf($msg['komu'], 'user').'</u>, ';
} else {
$komu = '';
}
$ig = mysql_query("SELECT * FROM `ignor` WHERE `user_id`='$id' AND `ig_id`='".(int)$msg['user_id']."'");
if (mysql_affected_rows() == false) {
if ($msg['privat'] == 0)
{
if ($row['level'] == 2) $D = '<small><a href="room.php?rm='.$rm.'&delete='.$msg['id'].'">[X]</a></small>';
if ($msg['user_id'] != 0) echo $div3.'<a href="inside.php?rm='.$rm.'&nk='.$msg['user_id'].'"><b>'.col($msg['user']).'</b></a> ('.date($msg['time']).')' . $D . '>' . $komu . text($text) . $div5;
} elseif ($msg['privat'] == $row['id'] || $msg['user_id'] == $row['id']) {
if ($row['level'] == 2) $D = '<small><a href="room.php?rm='.$rm.'&delete='.$msg['id'].'">[X]</a></small>';
if ($msg['user_id'] != 0) echo $div3.'<a href="inside.php?rm='.$rm.'&nk='.$msg['user_id'].'"><b>'.col($msg['user']).'</b></a> ('.date($msg['time']).')<b>[P!]</b>' . $D . '>' . $komu . text($text) . $div5;
} elseif (($msg['privat'] != $row['id'] || $msg['user_id'] != $row['id']) && $row['level'] == 2) {
if ($row['level'] == 2) $D = '<small><a href="room.php?rm='.$rm.'&delete='.$msg['id'].'">[X]</a></small>';
if ($msg['user_id'] != 0) echo $div3.'<a href="inside.php?rm='.$rm.'&nk='.$msg['user_id'].'"><b>'.col($msg['user']).'</b></a> ('.date($msg['time']).')<b>[!!!]</b>' . $D . '>' . $komu . text($text) . $div5;
}
}
}
// История
if (!isset($_GET['history']) && $k_page > 1)
{
echo $other;
str('room.php?rm='.$rm.'&history&', $k_page, $page);
echo $div5;
}
elseif (isset($_GET['history']) && $k_page > 1)
{
echo $other;
str('room.php?rm='.$rm.'&history&', $k_page, $page);
echo $div5;
}
echo $div5 . $div3 . '<a href="menu.php?'.$ref.'"><b>В меню</b></a>' . $div5;
include 'foot.php';
?>