Файл: tell.php
Строк: 67
<?
require'config.php';
$user['avr'] = 0;
$align='left';
$title='Сказать';
aut();
head();
if (!isset($user['user'])) { exit('Ошибка!Вам надо авторизоваться');}
if ($rm == 16) include 'bk/trainers.php';
if ($rm == 15) include 'bk/figth.php';
$rm = intval($_GET['rm']);
if (empty($rm)) header ('Location: enter?'.SID);
$rooms = $db->sql_fetchrow($db->sql_query("SELECT * FROM `rooms` WHERE `rm` = '$rm'"));
if ($rooms['intim']==1){
if(!isset($_POST['inps']) && isset($_SESSION['inps']))$inps = check(intval($_SESSION['inps']));
else $inps = check(intval($_POST['inps']));
$_SESSION['inps'] = $inps;
}
if(empty($inps)) $inps = 0;
if (($rooms['sartir']!=1) && ($user['kik']>$time)){
echo '<b>'.user($user['whokik']).'</b> выпнул вас из чата на <b>'.kikt($user['kik']).'</b> <br />Причина: <b>'.$user['whykik'].'</b><br />';
$rooms = $db->sql_query("SELECT * FROM `rooms` WHERE sartir = '1' ORDER BY `pos` ASC");
if($db->sql_numrows($rooms)!=0)echo 'Вам разрешен доступ только в<br />';
while($room = $db->sql_fetchrow($rooms)){
if ($room['level']<=$user['level'])echo '<a href="room?rm='.$room['rm'].'">'.$room['name'].'</a><br />';}
echo '<br />';
echo gbinroom.'<a href="enter">Прихожая</a>'.div;
foot();
}
if (empty($act)){
if ($ver!='wml')echo '<form action="tell?rm='.$rm.'&act=add&'.SID.'" method="post">';
if ($ver=='wml')echo '<br/><input name="msg'.$ref.'" maxlength="512" title="Text"/><br/>';
else echo '<br/><input name="msg" maxlength="512" title="Text"/><br/>';
if ($ver=='wml'){
echo '<br /><anchor title="go">Сказать<go href="tell?rm='.$rm.'&act=add&'.SID.'" method="post">';
echo '<postfield name="msg" value="$msg'.$ref.'"/>
<postfield name="dd" value="$dd"/>
<postfield name="emo" value="$emo"/>
<postfield name="color" value="$color"/>
</go></anchor>';
echo '<br/><br />';
}else{
echo '<br /><input type="submit" class="ibutton" value="Сказать"/></form><br /><br />';
}
}else{
$msg = check($_POST['msg']);
$dd = check($_POST['dd']);
$emo = check($_POST['emo']);
$color = check($_POST['color']);
$prvt = check($_POST['prvt']);
if(isset($_GET['nk'])) $nk = intval($_GET['nk']);
else $nk = 0;
if($prvt!=0){
if(isset($_POST['prvt']) && isset($_GET['nk'])) $privat = intval($_GET['nk']);
}else $privat = 0;
if (strlen2($msg)<2){header ('Location: room?rm='.$rm.'&'.SID); exit;}
$msg = iconv('utf-8', 'windows-1251', $msg);
$msg = substr($msg,0,512);
$msg = iconv('windows-1251', 'utf-8', $msg);
if ($user['translit']==1)$msg = translit($msg);
/*********/
if (!empty($user['lsmile'])) {
$msg = str_replace('.my.', '<img src="'.$user['lsmile'].'" alt="."/>', $msg);
}
if (!empty($user['lsmile2'])) {
$msg = str_replace('.my2.', '<img src="'.$user['lsmile2'].'" alt="."/>', $msg);
}
if (!empty($user['lsmile3'])) {
$msg = str_replace('.my3.', '<img src="'.$user['lsmile3'].'" alt="."/>', $msg);
}
/***********/
$mess=$db->sql_fetchfield($db->sql_query("select COUNT(*) from message WHERE `user_id` = '$user[id]' and `time`>'".($time - $rooms['flyd'])."';"),0);
if ($mess > 0){ header ('Location: room?rm='.$rm.'&err=t&'.SID.''); exit;}
if ($rooms['bot_bartender']!=0) require H.'bots/bot_bartender.php';
if ($rooms['inkog']!=0){
$db->sql_query ("INSERT INTO message (user,user_id,time,msg,rm,emo,bb,color,komu,privat) VALUES ('Инкогнито','0','$time','$msg','$rm','$emo','$dd','$color','$nk','$privat')");
}else{
$db->sql_query ("INSERT INTO message (user,user_id,time,msg,rm,emo,bb,color,komu,privat,inps) VALUES ('$user[user]','$user[id]','$time','$msg','$rm','$emo','$dd','$color','$nk','$privat','$inps')");
}
posts_add();
header ('Location: room?rm='.$rm.'&'.SID);exit;
}
echo gb.'<a href="room?rm='.$rm.'">В чат </a>'.div;
foot();
?>