Файл: public_html/chat2.php
Строк: 350
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
// время в прошлом склонении
function test($time_) {
if (time()-$time_<60) {
$vremya=time()-$time_;
return ' '.$vremya.'с назад';
}
elseif (time()-$time_>60 && time()-$time_<3600) {
$sec=(time()-$time_)%60;
$min=((time()-$time_)-$sec)/60;
return ' '.$min.'м '.$sec.'с назад';
}
elseif (time()-$time_>3600 && time()-$time_<3600*24) {
$min=((time()-$time_)/60)%60;
$hour=((time()-$time_)-((time()-$time_)%3600))/3600;
return ' '.$hour.'ч '.$min.'м назад';
}
elseif (time()-$time_>3600*24 && time()-$time_<3600*24*30) {
$hour=((((time()-$time_)-((time()-$time_)%3600))/3600)-((((time()-$time_)-((time()-$time_)%3600))/3600)%24))/24;
$den=((time()-$time_)-((time()-$time_)%(3600*24)))/(3600*24);
return ' '.$den.'дн '.$hour.'ч назад';
}
else {
return date('d.m.Y H:i:s', $time_);
}
}
if(!$user) { header('location: /'); exit; }
$title = ($_GET['clan'] == true) ? 'Клановый чат':'Общий чат';
include './system/h.php';
echo '<div class="main">';
if(isset($_SESSION['msg'])){
echo smiles($_SESSION['msg']);
unset($_SESSION['msg']);
}
?>
<div class="pvp_fon">
<?
if($user['avto']==1) {
?>
<center>
<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Refresh" content="60" />
</head>
<body>
<form name="myform"action="" method="post">
Авто обновлениe каждые 60 секунд</p>
<p>
<input type="submit"name="send" value="Сохранить"/>
</p>
</form>
</body>
</html>
</center>
<?
}
?>
<?
if($user['save'] == 0) {
echo '<div class='block_zero'><font color='#909090'>Для общения в чате вам нужно сохранить своего персонажа</font></div>';
}
else
{
echo '<div class='block_zero'>';
if($user['level'] < 20) {
echo '<font color='#909090'>Писать в чат можно с <img src='/images/icon/level.png' alt=''/> 20 уровня</font><br>';
}
else
{
$text = _string($_POST['text']);
$to = _string(_num($_GET['to']));
if($to) {
$_to = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$to.'"');
$_to = mysql_fetch_array($_to);
if(!$_to OR $_to['id'] == $user['id']) {
header('location: /chat2.php/'.($_GET['clan'] == true ? 'clan/':''));
exit;
}
}
if($text) {
$antiflood = mysql_fetch_array(mysql_query('SELECT * FROM `chat` WHERE `clan` = ''.($_GET['clan'] == true ? $clan['id']:0).'' AND `user` = ''.$user['id'].'' ORDER BY `time` DESC LIMIT 1'));
if(time() - $antiflood['time'] < 5) $errors[] = 'Писать можно только 1 раз в 5 секунд';
if($errors) {
echo '<div class='block' align='center'>';
foreach($errors as $error) {
echo $error.'<br/>';
}
echo '</div>
<div class='mini-line'></div>';
}
else
{
if($_to) {
$text = str_replace($_to['login'].', ', '', $text);
}
//$text = eregi_replace( "[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "(~)", $text);
$text = str_replace(array('',
'',
'',
'',
'tk',
'su',
'',
'',
'',
'',
''), 'спам', $text);
mysql_query('INSERT INTO `chat` (`clan`,
`user`,
`to`,
`text`,
`time`) VALUES ("'.($_GET['clan'] == true ? $clan['id']:0).'",
"'.$user['id'].'",
"'.$_to['id'].'",
"'.$text.'",
"'.time().'")');
$_SESSION['msg'] = '<center> <font color="lime"><img src="/images/icon/ok.png"> Сообщения отправлено!</font></center>';
if($user['zad1']==0) {
mysql_query("UPDATE `users` SET `qq2` = qq2 + 1 WHERE `id` = ".$user['id']."");
}
header('location: /chat2.php/'.($_GET['clan'] == true ? 'clan/':''));
mysql_query("UPDATE `clans` SET `w` = `w` + 1 WHERE `id` = ".$clan['id']."");
}
}
?>
<?
if($_GET['act']==hal) {
mysql_query("INSERT INTO `hal` SET `users` = ".$_to['login'].",`login` = ".$user['login']."");
header('location:?');
}
?>
<hr><hr>
<?
if($user['audio']==1) {
?>
<font color="lime"><center><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>audio</title>
</head>
<body>
<p>Город под подошвой</p>
<audio controls>
<source src="http://best-muzon.cc/dl/C6GGpD_YKHAJAU2lHVyAqQ/1493617148/songs12/2015/09/oxxxymiron-gorod-pod-podoshvojj-(best-muzon.cc).mp3" type="audio/ogg; codecs=vorbis">
<source src="http://best-muzon.cc/dl/C6GGpD_YKHAJAU2lHVyAqQ/1493617148/songs12/2015/09/oxxxymiron-gorod-pod-podoshvojj-(best-muzon.cc).mp3" type="audio/mpeg">
Тег audio не поддерживается вашим браузером.
<a href="audio/music.mp3">Скачайте музыку</a>.
</audio>
</body>
</html></center></font>
<?
if($user['audio']==0) {
?>
<center><font color='lime'><a class='btn22' href='/audio.php'>Поставить музыку в чат</a></font></center>
<?
}
?>
<?
}
?>
<?
if($user['audio']==2) {
?>
<font color="lime"><center><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>audio</title>
</head>
<body>
<p>Чорное золото (Ярмак)</p>
<audio controls>
<source src="http://dl2.mp3party.net/download/1159104" type="audio/ogg; codecs=vorbis">
<source src="http://dl2.mp3party.net/download/1159104" type="audio/mpeg">
Тег audio не поддерживается вашим браузером.
<a href="audio/music.mp3">Скачайте музыку</a>.
</audio>
</body>
</html></center></font>
<?
}
?>
<?
if($user['audio']==3) {
?>
<font color="lime"><center><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>audio</title>
</head>
<body>
<p>Пятнадцатый год</p>
<audio controls>
<source src="http://dl7.mp3party.net/download/8429613" type="audio/ogg; codecs=vorbis">
<source src="http://dl7.mp3party.net/download/8429613" type="audio/mpeg">
Тег audio не поддерживается вашим браузером.
<a href="audio/music.mp3">Скачайте музыку</a>.
</audio>
</body>
</html></center></font>
<?
}
?>
<?
if($user['audio']==4) {
?>
<font color="lime"><center><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>audio</title>
</head>
<body>
<p>Переплетено</p>
<audio controls>
<source src="http://dl1.mp3party.net/download/563224" type="audio/ogg; codecs=vorbis">
<source src="http://dl1.mp3party.net/download/563224" type="audio/mpeg">
Тег audio не поддерживается вашим браузером.
<a href="audio/music.mp3">Скачайте музыку</a>.
</audio>
</body>
</html></center></font>
<?
}
?>
<?
if($user['avto']==0) {
?>
<center>Авто обновление чата выкл/<a href="/chat2.php?act=on">вкл</a></center>
<?
}
?>
<?
if($user['avto']==1) {
?>
<center>Авто обновление чата <a href="/chat2.php?act=off">Выкл</a>/вкл</center>
<?
}
?>
<?
if($_GET['act']==on) {
mysql_query("UPDATE `users` SET `avto` = 1 WHERE `id` = ".$user['id']."");
header('location:?');
}
?>
<?
if($_GET['act']==off) {
mysql_query("UPDATE `users` SET `avto` = 0 WHERE `id` = ".$user['id']."");
header('location:?');
}
?>
<font color="orange"><?
$usn= mysql_query("SELECT * FROM `users` ORDER BY `id` DESC LIMIT 1");
while($usnew= mysql_fetch_assoc($usn)){
echo"<div class='block_zero'>";
$texter = 'Приветствуем нового игрока <a href="/user/'.$usnew[id].'">'.$usnew['login'].'</a>!</div><div class="mini-line"></div>';
echo '<center><img src="/images/smiles/mini_blush.gif"> '.$texter.'';
echo'';}
?></font>
<form name='form' method='post' action='/chat2.php/<?=($_GET['clan'] == true ? 'clan/':'')?>?to=<?=$to?>'><div class='fight center'><? echo bbpanel('form', 'text').'';?></div>
<form action='/chat2.php/<?=($_GET['clan'] == true ? 'clan/':'')?>?to=<?=$to?>' method='post'>
<?
if($user['chat']==1) {
echo "<center><font color='lime'>Вы нарушили привила игры! </font></center>";
}
?>
<?
if($user['chat']==0) {
?>
<center>
</div> <textarea height="24" width="100%"name='text' style='width: 99%;' class='text'/><?=($to ? $_to['login'].', ':'')?></textarea>
<center><input class='btn22' style='height: 25px;' type='submit' value='Отправить'>
<?
}
?>
<?
}
?>
<?
if($user['chat'] ==0) {
?>
<a style='height: 15px;' class="btn22" href="/chat2.php/">Обновить</a><hr><a href='/onlinechat.php'>
В чате <?=n_f(mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `online` > '".(time() - 3000)."' and `self` ='Общий чат'"),0))?> игроков!</a></hr>
</center></center>
</form>
<?
}
?>
<audio src="http://dl3.mp3party.net/download/2812959"></audio>
<audio>
<source src="http://dl3.mp3party.net/download/2812959">
</audio>
<?
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true ? $clan['id']:0).'"'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;
}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
if($count > 0) {
$msg = _string(_num($_GET['msg']));
if($msg) {
$i_msg = mysql_query('SELECT * FROM `chat` WHERE `id` = "'.$msg.'"');
$i_msg = mysql_fetch_array($i_msg);
if(!$i_msg) {
header('location: /chat2.php/'.($_GET['clan'] == true ? 'clan/':'').'?page='.$page);
exit;
}
if($_GET['clan'] == true && $clan_memb['rank'] == 4 OR $user['access'] > 0) {
mysql_query('DELETE FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true ? $clan['id']:0).'" AND`id` = "'.$i_msg['id'].'"');
}
header('location: /chat2.php/'.($_GET['clan'] == true ? 'clan/':'').'?page='.$page);
}
$q = mysql_query('SELECT * FROM `chat` WHERE `clan` = "'.($_GET['clan'] == true ? $clan['id']:0).'" ORDER BY `id` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
if($row['to'] == $user['id'] && $row['read'] == 0) {
mysql_query('UPDATE `chat` SET `read` = "1" WHERE `id` = "'.$row['id'].'"');
}
$sender = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
$sender = mysql_fetch_array($sender);
if($row['user'] == 2){
$sender['login'] = 'Система';
$sender['r'] = 'bot';
}
?>
<font-family: Verdana, Arial, Helvetica, sans-serif>
<div class="one_by_one"><font size=2px>
<img src='/images/icon/race/<?=$sender['r']?>.png' alt='*'/>
<a href='/user/<?=$sender['id']?>/'><?=$sender['login']?> </a>
<?
if($sender['access']==1) {
if($sender['chat']==0) {
echo '<font color="lime"><u>Мд</u></font>';
}
}
?>
<?
if($sender['id']==1) {
if($sender['chat']==0) {
echo '<font color="orange"><u>адм</u></font>';
}
}
?>
<?
if($sender['id']==3) {
if($sender['chat']==0) {
echo '<font color="red"><u>Соз</u></font>';
}
}
?>
<?
if($sender['chat']==1) {
echo '<font color="red">[Бан]</font>';
}
?>
<?
if($sender['id'] != $user['id']) {
?> <a href='/chat2.php/<?=($_GET['clan'] == true ? 'clan/':'')?>?to=<?=$sender['id']?>'>(»)</a><?
}
?>:<div class='right'><font color='darkred'><?=test($row['time'] )?></font></div><?
if($row['to']) {
$__to = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['to'].'"');
$__to = mysql_fetch_array($__to);
if($__to['id'] == $user['id']) {
?>
<font color='lime'>
<?
}
?>
<?=$__to['login']?>,
<?
if($__to['id'] == $user['id']) {
?>
</font>
<?
}
}
if($sender['access'] == 1) {
?>
<font color='#f09060'>
<?
}
?>
<?
if($sender['access'] == 2) {
?>
<font color='#90c0c0'>
<?
}
?>
<?
if($sender['sex']==0) {
?>
<font color='violet'>
<?
}
?>
<?
if($sender['sex']==1) {
?>
<font color='gold'>
<?
}
?>
<?
if($_GET[act]==banned) {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
header('location:?');
}
?>
<?
if($row['text']=='wartron') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='wartron') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='wartron.*') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='h ttp : //b t. m mars .r u /chat2.php/') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Нахуй') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Админ пидар') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Я ебал админа') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Wartron') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Wartron.r u') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='wartron.r u') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Вартрон') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='вартрон') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Пиздец') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='пиздец') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Я ебал админа') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Снесу игру нахуй') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Снесу игру') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Ебать') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Сука') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Иди нахуй') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Чушка') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Пидар') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Отьебись') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Ебал') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Заебали') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Админ лох') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Дай адиинку') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Дай админа') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='дай админку') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='дай админа') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='дайте золота') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Дайте золота') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Админы ебланы') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Я твою мать ебал') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='я твою мать ебал') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='mresh.r u') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='mresh') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Mresh.r u') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Mresh') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='mresh.ру') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='мреч.ру') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='tiwar.pro') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='tiwar.p r o') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Tiwar.pro') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Tiwar.p r o') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?
if($row['text']=='Заебал админ') {
mysql_query("UPDATE `users` SET `chat` = 1 WHERE `id` = ".$row['user']."");
}
?>
<?=smiles($row['text'])?>
<?
if($sender['access'] > 0) {
?>
</font>
<?
}
if($user['access'] > 0) {
?>
<a href='/chat2.php/<?=($_GET['clan'] == true ? 'clan/':'')?>?msg=<?=$row['id']?>'>(x)</a><a href="?act=hal"></a>
<?
}
?>
</font>
<a href='/chat2.php/?jobs&id=<?=$row['id']?>'><small>[ж]</small></a></div></font>
<?
if(isset($_GET['jobs']) && $sender['id'] != $user['id']) {
$id = _string(_num($_GET['id']));
$_ch = mysql_fetch_array(mysql_query('SELECT * FROM `chat` WHERE `id` = "'.$id.'"'));
$_us = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_ch['user'].'"'));
$cp = mysql_fetch_array(mysql_query('SELECT * FROM `complaints`'));
if(!$_ch OR $cp['from'] == $id) exit(header('location: /chat2.php/'));
$_msg_jobs = 'Пользователь: <a href=/user/'.$user['id'].'/><img src='/images/icon/race/'.$user['r'].'.png' alt=''/> '.$user['login'].'</a><br /> Пожаловался на: <a href=/user/'.$_us['id'].'/><img src='/images/icon/race/'.$_us['r'].'.png' alt=''/>'.$_us['login'].'</a><br /> Сообщение в чате: <br><font color=#90c0c0>['.$_ch['text'].']</font>.';
mysql_query('INSERT INTO `complaints` (
`from`,
`who`,
`text`,
`time`
) VALUES ("'.$row['id'].'",
"'.$user['id'].'",
"'.$_msg_jobs.'",
"'.time().'")');
$Moderators = mysql_query("SELECT `id` FROM `users` WHERE `access` > '0'");
while ($ms = mysql_fetch_assoc($Moderators))
{
mysql_query('UPDATE `users` SET `jobs` = "1" WHERE `id` = ''.$ms['id'].''');
}
exit(header('Location: /chat2.php/'));
}
?>
<?
}
}
else
{
?>
<font color='#909090'>Сообщений нет</font>
<?
}
?>
<?
if($clan) {
$_chat = mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "0" AND `to` = "'.$user['id'].'" AND `read` = "0"');
$_chat = mysql_result($_chat,0);
$_clan_chat = mysql_query('SELECT COUNT(*) FROM `chat` WHERE `clan` = "'.$clan['id'].'" AND `to` = "'.$user['id'].'" AND `read` = "0"');
$_clan_chat = mysql_result($_clan_chat,0);
?>
<div class="dot-line"></div>
<div class="block_zero medium">
<img src="/images/icon/chat.png" alt=""> <?=($_GET['clan'] == true ? '<a href="/chat2.php/">Титаны</a>':'<span class="grey">Титаны</span>')?><?=($_chat > 0 ? '<span class="green"> (+)</span>':'')?> | <?=($_GET['clan'] == true ? '<span class="grey">Клан</span>':'<a href="/chat2.php?action=clan/">Клан</a>')?><?=($_clan_chat > 0 ? '<span class="green"> (+)</span>':'')?>
</div>
<?
}
?>
<div class="dot-line"></div>
<div class="block_zero"><?=pages('/chat2.php/'.($_GET['clan'] == true ? 'clan/':'').'?');?></div>
<div class="dot-line"></div>
<?
if($_GET['read_all'] == true) {
mysql_query('UPDATE `chat` SET `read` = "1" WHERE '.($_GET['clan'] == true ? '`clan` = "'.$clan['id'].'" AND':'').' `to` = "'.$user['id'].'"');
header('location: /chat2.php/'.($_GET['clan'] == true ? 'clan/':''));
}
?>
<?
if($user['access']==3) {
echo '<a class="btn22" href="/chat2.php?act=truncate">Очистить чат</a>';
}
?>
<?
if($clan['access']==3){
$_SESSION['msg']="lele!";
header('location:?');
}
if($_GET['act']==truncate) {
if($user['access']==3) {
mysql_query("TRUNCATE TABLE `chat`");
header('location:?');
}
}
if(isset($_GET['call_moderator']) && $_SESSION['call'] < time() && $user['access'] <= 0) {
$Moderator = mysql_query("SELECT `id` FROM `users` WHERE `access` == '1'");
while ($m = mysql_fetch_assoc($Moderator))
{
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `contacts` WHERE `user` = ''.$user['id'].'' AND `ho` = ''.$m['id'].'''),0) == 0) {
mysql_query('INSERT INTO `contacts` (`user`,
`ho`,
`time`) VALUES (''.$user['id'].'',
''.$m['id'].'',
''.time().'')');
}
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `contacts` WHERE `ho` = "'.$user['id'].'" AND `user` = "'.$m['id'].'"'),0) == 0) {
mysql_query('INSERT INTO `contacts` (`ho`,
`user`,
`time`) VALUES (''.$user['id'].'',
''.$m['id'].'',
''.time().'')');
}
$text = '<font color='#909090'>Игрок: <img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <a href=/user/'.$user['id'].'/>'.$user['login'].'</a> позвал вас в чат, возможно нарушены правила игры, перейди в <a href=/chat2.php/>чат</a>.</font>';
mysql_query('INSERT INTO `mail` (`from`,
`to`,
`text`,
`time`) VALUES ("'.$user['id'].'",
"'.$m['id'].'",
"'.$text.'",
"'.time().'")');
mysql_query('UPDATE `contacts` SET `time` = ''.time().'' WHERE `user` = ''.$user['id'].'' AND `ho` = ''.$m['id'].''');
mysql_query('UPDATE `contacts` SET `time` = ''.time().'' WHERE `ho` = ''.$user['id'].'' AND `user` = ''.$m['id'].''');
$_SESSION['call'] = time() + 600;
}
exit(header('Location: /chat2.php/'));
}
?>
<div class="menuList">
<li><a href='/chat2.php/<?=($_GET['clan'] == true ? 'clan/':'')?>?read_all=true'><img src='/images/icon/arrow.png' alt='*'/> Отметить все сообщения как прочитанные</a></li>
<li><a href="/smiles.php"><img src="/images/icon/user.png" alt="">Смайлы</a></li>
<li><a href='/chat2.php/?call_moderator'><img src='/images/icon/user.png' alt='*'/> Позвать модератора</a></li>
<li><a href="/moderators"><img src="/images/icon/user.png" alt="">Список модераторов</a></li>
<li><a href="/forum/topic/30/"><img src="/images/icon/arrow.png" alt="">Правила чата</a></li>
</div>
<?
}
?>
</div>
<?
include './system/f.php';
?>