View file chatservice/room.php

File size: 6.96Kb
<?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";
mysql_query ("select * from bannedib WHERE ci='$ci' AND (ip = '".getenv(REMOTE_ADDR)."')and(browser = '".getenv(HTTP_USER_AGENT)."')");
                        if(mysql_affected_rows()!=0){include "b.php";}
$start = gettime();
$r = rand(0,100000);

$login = autorize();

$query_settings = @mysql_query("select `val2` from `".$px.$stable."` where var='$room' and mod='room' and ci='".$login['ci']."';");

$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 ci='".$ci."' and `new`=1;");
$num_in=@mysql_fetch_array($q_letters_in);
$pr_count = @mysql_query("SELECT count(*) FROM `".$px.$utable."` WHERE ltime>'".intval(time()-$offline)."' AND room='$room' and ci= '$ci';");

$pdc = @mysql_fetch_array($pr_count);
if($mod=="privat")
print '<card id="main" title="'.$settings['val2'].'-('.$pdc['count(*)'].')" ontimer="room.php?ci='.$ci.'&amp;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'].'-('.$pdc['count(*)'].')" ontimer="room.php?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'"><timer value="'.$time_update.'"/>';
print '<do type="options" name="update" label="&#1054;&#1073;&#1085;&#1086;&#1074;&#1080;&#1090;&#1100;"><go href="room.php?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="say" label="&#1057;&#1082;&#1072;&#1079;&#1072;&#1090;&#1100;"><go href="#say" method="get"/></do>'.
'<do type="options" name="whowhere" label="&#1050;&#1090;&#1086;?&#1043;&#1076;&#1077;?"><go href="online.php?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="letters" label="&#1055;&#1080;&#1089;&#1100;&#1084;&#1072;('.$num_in['count(*)'].')"><go href="letters/inbox.php?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;r='.$r.'" method="get"/></do>'.
'<do type="options" name="holl" label="&#1055;&#1088;&#1080;&#1093;&#1086;&#1078;&#1072;&#1103;"><go href="enter.php?ci='.$login['ci'].'&amp;id='.$id.'&amp;pass='.$pass.'&amp;r='.$r.'" method="get"/></do>';
if($room=="vict") print '<do type="options" name="stats" label="&#1058;&#1086;&#1087; 10"><go href="statistic.php?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;mod=stats&amp;r='.$r.'" method="get"/></do>';

print '<do type="options" name="RUwap" label="ruwap.con.ru"><go href="http://ruwap.com.ru" 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 * from `".$px.$vtable."` where ci='".$ci."' and login='".$login['login']."' order by id desc;");
        else
        $query_msg = @mysql_query("select * from `".$px.$mtable."` where ci='".$ci."' and 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."' and ci='$ci';");
        require "./room.inc.php"; }
        } else {
        @mysql_query("update `".$px.$utable."` set ltime='".time()."', room='".$room."' where id='".$id."' and ci='$ci';");

        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()."','$ci');");
        else
        @mysql_query("insert into `".$px.$mtable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','".time()."','$room','$ci');");

        @mysql_query("update `".$px.$utable."` set posts='".++$posts."', ltime='".time()."' where id='".$id."' and ci='$ci';"); }

        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?ci='.$ci.'&amp;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?ci='.$ci.'&amp;id='.$id.'&amp;pass='.$pass.'&amp;room='.$room.'&amp;r='.$r.'">'.$lang['to_chat'].'</a><br/>'.
'</p>'.
'</card>'.
'</wml>';
?>