View file nwchat/chat/room.php

File size: 6.61Kb
<?php
//Ї®бл« Ґ¬ § Ј®«®ў®Є
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
//­ з «® ўлў®¤  ў Ўа г§Ґа
print '<?xml version="1.0" encoding="utf-8"?>';
print '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';
include "./ini.php";
$start = gettime();
$r = rand(0,100000);
// ўв®аЁ§ жЁп
$login = autorize();
//Ї®бл« Ґ¬ ў Ў §г § Їа®бл
$query_settings = @mysql_query("select `val2` from `".$px.$stable."` where var='$room' and mod='room';");
//§ Їа®б ў ¬ ббЁў
$settings = @mysql_fetch_array($query_settings);
//¤®бв Ґ¬ Ё§ Ў §л Ї®«м§®ў вҐ«мбЄЁҐ ­ бва®©ЄЁ
$num_msgs = $login['nmsgs'];
$time_update = $login['tupdate'];
//Ї®«м§®ў вҐ«мбЄЁҐ ­ бва®©ЄЁ
if(empty($num_msgs)) $num_msgs=5;
if(empty($time_update)) $time_update=300;
//⥪г饥 ўаҐ¬п
$timenow = strftime("%H:%M");
//§ Ј®«®ў®Є Є®¬­ вл
$rtitle = $settings['val2'];
//®Ўа Ў влў Ґ¬ Ї®«г祭­лҐ ¤ ­­лҐ
$pass=htmlspecialchars(stripslashes(trim($pass)));
$room=htmlspecialchars(stripslashes(trim($room)));
//г§­ Ґ¬ Є®«ЁзҐбвў® ­®ўле ЇЁбҐ¬
$q_letters_in = @mysql_query("select count(*) from `".$px.$ltable."` where `to_user`='".$login['login']."' and `new`=1;");
$num_in=@mysql_fetch_array($q_letters_in);	//г§­ Ґ¬ Є®«ЁзҐбвў® ўе®¤пйЁе ­®ўле ЇЁбҐ¬
//ЇҐз в Ґ¬ бва ­Ёжг ¤ «миҐ
if($mod=="privat")
print '<card id="main" title="'.$settings['val2'].'-'.$timenow.'" ontimer="room.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;mod=$mod&amp;r='.$r.'"><timer value="'.$time_update.'"/>';
else
print '<card id="main" title="'.$settings['val2'].'-'.$timenow.'" ontimer="room.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'"><timer value="'.$time_update.'"/>';
print '<do type="options" name="update" label="'.$lang['update'].'"><go href="room.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="say" label="'.$lang['say'].'"><go href="#say" method="get"/></do>'.
'<do type="options" name="whowhere" label="'.$lang['who_online'].'"><go href="online.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="letters" label="'.$lang['letters'].'('.$num_in['count(*)'].')"><go href="letters/inbox.php?id='.$id.'&amp;pass='.$pass.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="holl" label="'.$lang['holl'].'"><go href="online.php?id='.$id.'&amp;pass='.$pass.'&amp;r='.$r.'" method="get"/></do>';
if($room=="vict") print '<do type="options" name="stats" label="'.$lang['stats'].'"><go href="statistic.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;mod=stats&amp;r='.$r.'" method="get"/></do>';
print '<p>';
//ўлв бЄЁў Ґ¬ ­Ґ®Ўе®¤Ё¬л ¤ ­­лҐ Ё§ ¬ ббЁў   ўв®аЁ§ жЁЁ
$posts = $login['posts'];
$moder = $login['moder'];
$admin = $login['admin'];
$ltime = $login['ltime'];
$ban = $login['ban'];
$btime = $login['btime'];
$breason = $login['breason'];
//Ґб«Ё  ўв®аЁ§ жЁп гбЇҐи­ , Ё¤Ґ¬ ¤ «миҐ
if($login) { //Ґб«Ё Є®¬­ в  бгйҐбваўгҐв
	if(!empty($room)) {
	//ЇаЁў в
	if(!empty($private)) $pr = explode(".",$private);
	//§ Їа®б ў Ў¤
	if($room=="vict")
	$query_msg = @mysql_query("select `msg` from `".$px.$vtable."` where login='".$login['login']."' order by id desc;");
	else
	$query_msg = @mysql_query("select `msg` from `".$px.$mtable."` where login='".$login['login']."' order by id desc;");
	$prevmsg = @mysql_fetch_array($query_msg);
	//Ґб«Ё Ї®«м§®ў вҐ«м гЎЁв
	if($ban == "kill")
	print $lang['you_are_killed'];
	//Ґб«Ё ўлЇ­гв
	elseif(!empty($ban)) {
	if($btime >= time()) {
	$enter = $btime - time();
	print "<b>$ban ".$lang['kick_you'].$lang['reason'].": $breason! ".$lang['unban']."<u>".$enter."</u>".$lang['s']."!</b><br/>";
	} else {
	@mysql_query("update `".$px.$utable."` set ban='', btime='', breason='' where id='".$id."';");
	require "./room.inc.php"; }
	} else {
	@mysql_query("update `".$px.$utable."` set ltime='".time()."', room='".$room."' where id='".$id."';");
	//////////////////////////////////////////////////////
	if($translit=="user") { $nik=strtok($msg," "); $msg=strstr($msg," "); $msg=latrus($msg); $msg=$nik.$msg; }
	if($translit=="toall") { $msg=latrus($msg); }
	$msg=htmlspecialchars(stripslashes(trim($msg)));
	if($login['admin'] && $bold) $msg = "<b>".$msg."</b>";
	if($login['moder'] && $underline) $msg = "<u>".$msg."</u>";
	//ўЄ«оз Ґ¬ д ©«, ®вўҐвб⢥­­л© §  Є®­ўҐав жЁо ®ЇаҐ¤Ґ«Ґ­­®Ј® ⥪бв  ў б¬ ©«л
	include "./sm/convert_to_smiles.php";
	//Ґб«Ё б®®ЎйҐ­ЁҐ ­Ґ Їгбв®
	if(!empty($msg) && $msg!=$prevmsg['msg']) {
	//§ ЇЁблў Ґ¬ б®®ЎйҐ­ЁҐ ў Ў §г ¤ ­­ле
	if($room=="vict")
	@mysql_query("insert into `".$px.$vtable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','','','".time()."');");
	else
	@mysql_query("insert into `".$px.$mtable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','".time()."','$room');");
	//®Ў­®ў«Ґ­ЁҐ Ї®бв®ў Ї®«м§®ў вҐ«п
	@mysql_query("update `".$px.$utable."` set posts='".++$posts."', ltime='".time()."' where id='".$id."';"); } 
	//ўлў®¤Ё¬ б ¬г Є®¬­ вг
	if($room=="vict") include "./vict.inc.php";
	//гбв ­ ў«Ёў Ґ¬ а §¬Ґа иаЁдв 
	if($login['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
	elseif($login['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
	else { $fsize1 = ""; $fsize2 = ""; }
	//ўлў®¤Ё¬ Є®¬­ вг
	print $fsize1;
	include "./room.inc.php";
	print $fsize2;
		}	 } else { print $lang['room_not_exist']; }
	} else { print $lang['not_loged']; }
//ђ §алў Ґ¬ ᮥ¤Ё­Ґ­ЁҐ б Ў¤
@mysql_close();
$end = gettime();
print "<small>[".round(($end - $start), 5)."]</small>";
//§ Є ­зЁў Ґ¬ ЇаҐ¤л¤гйЁо Є авг Ё ­ зЁ­ Ґ¬ ­®ўго
print '</p>'.
'</card>'.
'<card id="say" title="'.$lang['say'].'">'.
'<p>'.
'<input name="msg'.$r.'"/><br/>'.
'<select multiple="true" name="translit">'.
'<option value="toall">Translit</option></select><br/>';
if($login['admin']) print '<select multiple="true" name="bold"><option value="1">'.$lang['bold'].'</option></select><br/>';
if($login['moder']) print '<select multiple="true" name="underline"><option value="1">'.$lang['underline'].'</option></select><br/>';
print '<anchor>'.$lang['say'].'<go href="room.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'" method="post">'.
'<postfield name="msg" value="$(msg'.$r.')"/>'.
'<postfield name="bold" value="$(bold)"/>'.
'<postfield name="underline" value="$(underline)"/>'.
'<postfield name="translit" value="$(translit)"/></go></anchor>'.
'<br/><a href="room.php?id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'">'.$lang['to_chat'].'</a><br/>'.
'</p>'.
'</card>'.
'</wml>';
?>