<?
//list($msec,$sec)=explode(chr(32),microtime());$HeadTime=$sec+$msec;
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
$ref=rand(10000,1000000);
require("inc.php");
function getmicrotime() //Микровремя
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$link = @mysql_pconnect ($MySQL_Hostname, $MySQL_Username, $MySQL_Password)
or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>Can not connect to MySQL</small></p>
</card></wml>");
@mysql_select_db($MySQLDatabasename) or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>error select the database...</small></p>
</card></wml>");
$result = @mysql_query ("Select pass,user,posts,avr,max,level,ignor,kik,whokik,whykik,user_ip,user_soft,inv,translit,smiles,safe,credits,fsize from users where id='".$id."' LIMIT 1;");
if (mysql_affected_rows() == 0) {
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "Юзер не найден!";
echo "</small></p></card></wml>";
mysql_close($link);
exit;
}
$row = mysql_fetch_array ($result);
if ($ps !== $row["pass"]){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "Не верное сочетание ника и пароля!";
echo "</small></p></card></wml>";
mysql_close($link);
exit;
}
$us=$row["user"];
$max = $row["max"];
$smset = $row["smiles"];
if ($rm<0||$rm>10||!isset($rm)) exit;
$room="room".$rm;
//К викторине
$agent = $HTTP_USER_AGENT;
/*
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"Стоп!\" ontimer=\"enter.php?id=$id&ps=$ps&ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "С компа доступ сюда закрыт!!!!";
echo "</small></p></card></wml>";
exit;
mysql_close($link);
}
*/
//Предупреждение о безопасности
$addr = $REMOTE_ADDR;
if(($row["user_soft"]!==$agent||$row["user_ip"]!==$addr)&&$row["safe"]==1)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"warning\" title=\"Внимание!\">";
echo "<p align=\"center\"><small>";
echo "<a href=\"chat.php?id=$id&ps=$ps&rm=$rm&ref=$ref\">Продолжить</a><br/>";
echo "<b>Предупреждение о безопасности</b><br/>";
$us_ip = $row["user_ip"];
$us_soft = $row["user_soft"];
mysql_query ("Update users set user_soft='".$agent."', user_ip = '".$addr."' WHERE id = '".$id."';");
echo "Внимание! Ваш текущий софт или ip адрес не совпадают с ip+soft последнего захода. Если вы не использовали в последнее время ip $us_ip или софт $us_soft, это может означать, что кто-то заходит с Вашего ника. Рекомендуем сменить ваш пароль. Отключить систему безопасности можно в настройках чата, но это не рекомендуется.";
echo "<br/><a href=\"chat.php?id=$id&ps=$ps&rm=$rm&ref=$ref\">Продолжить</a><br/>";
echo "</small></p></card></wml>";
exit;
}
else
if ($row["user_soft"]!==$agent||$row["user_ip"]!==$addr) mysql_query ("Update users set user_soft='".$agent."', user_ip = '".$addr."' WHERE id = '".$id."';");
//Бан по ip-soft
mysql_query ("Select `klu4` from bannlist WHERE (ip = '".$addr."')and(soft = '".$agent."') LIMIT 1;");
if ((mysql_affected_rows()!=0)&&($rm!=9))
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>";
echo "<card id=\"ban\" title=\"Стоп!\" ontimer=\"index.php?ref=$ref\"><timer value=\"300\"/>";
echo "<p align=\"center\"><small>";
echo "Вы забанены по связке ip+soft!!!<br/>";
echo "Р? доступ вам разрешен только РІ <a href=\"chat.php?id=$id&ps=$ps&rm=9&rul=9&ref=$ref\">Сортир</a>";
echo "</small></p></card></wml>";
mysql_close($link);
exit;
}
//End ip-soft
//Пинок
if((time()<$row["kik"]&&$rm!=9)||(time()<$row["kik"]&&$rm==9&&$row["whokik"]=="[Система]"))
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>";
echo "<card id=\"vypnut\" title=\"Стоп!\" ontimer=\"index.php?ref=$ref\"><timer value=\"300\"/>";
echo "<p align=\"center\"><small>";
$tleft = $row["kik"] - time();
$whokik = $row["whokik"];
$whykik = $row["whykik"];
echo "$whokik выпнул вас из чата. Разбан через $tleft (сек)<br/>";
echo "Причина: $whykik<br/>";
//echo "А пока вам разрешен доступ только в <a href=\"chat.php?id=$id&ps=$ps&rm=9&rul=9&ref=$ref\">Сортир</a>";
echo "</small></p></card></wml>";
mysql_close($link);
exit;
}
//End пинок
function trun_to_rus($str)
{
$str=str_replace("ch","С‡",$str);
$str=str_replace("sc","С‰",$str);
$str=str_replace("ye","СЌ",$str);
$str=str_replace("yu","СЋ",$str);
$str=str_replace("ya","СЏ",$str);
$str=str_replace("CH","Р§",$str);
$str=str_replace("SC","Р©",$str);
$str=str_replace("\"\"","РЄ",$str);
$str=str_replace("\"","СЉ",$str);
$str=str_replace("''","Р¬",$str);
$str=str_replace("'","СЊ",$str);
$str=str_replace("YE","Р",$str);
$str=str_replace("YU","Р®",$str);
$str=str_replace("YA","РЇ",$str);
$str=strtr($str,array("a"=>"Р°","b"=>"Р±","v"=>"РІ","g"=>"Рі","d"=>"Рґ","e"=>"Рµ","j"=>"Р¶","z"=>"Р·","i"=>"Рё","y"=>"Р№","k"=>"Рє","l"=>"Р»","m"=>"Рј","n"=>"РЅ","o"=>"Рѕ","p"=>"Рї","r"=>"СЂ","s"=>"СЃ","t"=>"С‚","u"=>"Сѓ","f"=>"С„","h"=>"С…","c"=>"С†","w"=>"С€","x"=>"С‹","A"=>"Рђ","B"=>"Р‘","V"=>"Р’","G"=>"Р“","D"=>"Р”","E"=>"Р•","J"=>"Р–","Z"=>"Р—","I"=>"Р?","Y"=>"Р™","K"=>"Рљ","L"=>"Р›","M"=>"Рњ","N"=>"Рќ","O"=>"Рћ","P"=>"Рџ","R"=>"Р ","S"=>"РЎ","T"=>"Рў","U"=>"РЈ","F"=>"Р¤","H"=>"РҐ","C"=>"Р¦","W"=>"РЁ","X"=>"Р«"));
return $str;
}
//Автоматическая оптимизация и чистка
$optim=0;
$f=fopen("syst/optim.dat","a+");
flock($f,LOCK_EX);
$optimdata=file("syst/optim.dat");
if ($optimdata[0]<time()){
ftruncate($f,0);
$optimdata = time() + 50800;
fwrite($f,$optimdata);
fflush($f);
$optim=1;
}
flock($f,LOCK_UN);
fclose($f);
if($optim==1){
for ($num = 0; $num <= 10; $num++)
{
$roptim = "room".$num;
$dt = time() - 50800;
mysql_query ("Delete from $roptim where id<'".$dt."'");
mysql_query("OPTIMIZE TABLE $roptim");
}
}
//Конец чистки
//Бот Анекдот
$printan=0;
$f=fopen("syst/anekdot.dat","a+");
flock($f,LOCK_EX);
$andata=file("syst/anekdot.dat");
if ($andata[0]<time())
{
ftruncate($f,0);
$andata = time() + 1200;
fwrite($f,$andata);
fflush($f);
$printan=1;
}
flock($f,LOCK_UN);
fclose($f);
if($printan==1)
{
$r = mysql_query("select count(klu4) as num from anekdot");
$a = mysql_fetch_array($r);
$rnd = rand(1,$a["num"]);
$r = mysql_query ("SELECT message FROM anekdot WHERE klu4 = '".$rnd."' LIMIT 1;");
$b = mysql_fetch_array($r);
$mes = $b["message"];
$rnd = rand(0,99999999);
$today=date ("H:i");
$time = getmicrotime();
for ($num = 0; $num <= 9; $num++)
{
$ranec = "room".$num;
mysql_query ("Insert into $ranec set klu4= '".$rnd."', time='".$today."', who='Шутник', message='".$mes."', id='".$time."', towhom='', hid='0', usid=''");
mysql_query("ANALYZE TABLE $ranec");
}
}
//Конец бота
$smthwr = 0;
$bmax = $max*2;
if (empty($pwd)) $pwd=pub;
if ($rm == 10){
$res = mysql_query ("Select time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid,pwd from room10 WHERE ((pwd = '".$pwd."')OR(pwd = '')) and ((usid = '".$id."')OR(towhom = '".$id."')OR(towhom = '')) order by id desc LIMIT $bmax");
} else {
$res = mysql_query ("Select time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid from $room WHERE (usid = '".$id."')OR(towhom = '".$id."')OR(towhom = '') order by id desc LIMIT $bmax");
}
$kol = mysql_affected_rows();
$lines = mysql_fetch_array ($res);
if ($rm == 10){
$topic= "Интим";
} else {
@$topic = $lines["message"];
}
if($rm==0){
$uid = "2";
$uus = "РЈРјРЅРёРє";
require("syst/umnik1.php");
}
if(@$msg)
{
$msg = trim(" $msg ");
$msg = ereg_replace(" +"," ",$msg);
$msg = substr($msg,0,400);
$msg = str_replace("", " ", $msg);
$msg = str_replace("$", "$$", $msg);
$msg = strtr($msg,array(chr("0")=>"",chr("1")=>"",chr("2")=>"",chr("3")=>"",chr("4")=>"",chr("5")=>"",chr("6")=>"",chr("7")=>"",chr("8")=>"",chr("9")=>"",chr("10")=>"",chr("11")=>"",chr("12")=>"",chr("13")=>"",chr("14")=>"",chr("15")=>"",chr("16")=>"",chr("17")=>"",chr("18")=>"",chr("19")=>"",chr("20")=>"",chr("21")=>"",chr("22")=>"",chr("23")=>"",chr("24")=>"",chr("25")=>"",chr("26")=>"",chr("27")=>"",chr("28")=>"",chr("29")=>"",chr("30")=>"",chr("31")=>""));
$msg = str_replace("к","С‘",$msg);
$msg = htmlspecialchars($msg);
$msg = addslashes($msg);
//if ($row["translit"]==0) $msg = str_replace("'", "'", $msg);
if (!isset($prvt)) $prvt = 0;
$str1="";
$str2=$msg;
if (($translit==1)||($row["translit"]==1)){
$r = mysql_query("select user from users WHERE id = '".$towhom."' LIMIT 1;");
$a = mysql_fetch_array($r);
if (strpos($msg,$a["user"])===0)
{
$str1 = substr($msg,0,strlen($a["user"]));
$str2 = substr($msg,strlen($a["user"]),strlen($msg)-strlen($a["user"]));
$msg = $str2;
}
}
if ($prvt == 0) $towhom = "";
if (!isset($towhom)) $towhom = "";
require("syst/smile.php");
$minpos = 500; $nm = 500;
for ($j=0;$j<=count($smiles)-1;$j++)
{
$tmpp = strpos($msg,$smiles[$j]);
if (($tmpp < $minpos)&&($tmpp !== false))
{
$minpos = $tmpp; $nm = $j;
};
};
if ($minpos !=500)
{
if (($translit!=1)||($row["translit"]==1))
{
$st1 = substr($msg,0,$minpos+strlen($smiles[$nm]));
$st2 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1));
$st1_wosm = $st1;
$st1 = str_replace($smiles[$nm],$replaces[$nm],$st1);
if (strpos($replaces[$nm],"smilean/")!==false) $st1_woasm = $st1_wosm; else $st1_woasm = $st1;
$msg_woasm = $st1.$st2;
$msg_wosm = $st1_wosm.$st2;
$msg = $st1_woasm.$st2;
} else
{
$st1 = substr($msg,0,$minpos);
$st2 = substr($msg,$minpos, strlen($smiles[$nm]));
$st3 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1)-strlen($st2));
if ($room!="room0") $st1 = trun_to_rus($st1);
$st2_wosm = $st2;
$st2 = $replaces[$nm];
if (strpos($replaces[$nm],"smilean/")!==false) $st2_woasm = $st2_wosm; else $st2_woasm = $st2;
if ($room!="room0") $st3 = trun_to_rus($st3);
$msg = $st1.$st2_woasm.$st3;
$msg_wosm = $st1.$st2_wosm.$st3;
$msg_woasm = $st1.$st2.$st3;
}
}
else if (($translit==1)||($row["translit"]==1)&&($room!="room0")) $msg = trun_to_rus($msg);
unset($smiles);
unset($replaces);
if($row["level"]>6)$msg = eregi_replace("((http://))((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)", "<a href=\"\\0\">\\3</a>", $msg);
$msg = $str1.$msg;
if (@$msg_wosm!="") $msg_wosm = $str1.$msg_wosm;
if (@$msg_woasm!="") $msg_woasm = $str1.$msg_woasm;
if(($row["level"]>=6) && $bold)
$msg = '<b>'.$msg.'</b>';
if (($row["level"]>=4) && $underline)
$msg = '<u>'.$msg.'</u>';
//Антифлуд
$r = mysql_query("SELECT message FROM $room WHERE usid = '".$id."' order by id desc LIMIT 1");
$a = mysql_fetch_array($r);
if ($a["message"] !== $msg)
{
//Автоантифлуд
$time = getmicrotime();
$ftime = $time - 90;
$r = mysql_query("SELECT count(*) as sum from $room WHERE (usid = '".$id."')and(id > '".$ftime."')");
$a = mysql_fetch_array($r);
$sum = $a["sum"];
if ($sum>=5&&$row["level"]<4)
{
$ftime = $time + 240;
mysql_query("update users set kik = '".$ftime."', whykik = 'флуд', whokik = '[Система]' WHERE id = '".$id."'");
}
$today=date ("H:i");
$posts = $row["posts"];
$posts++;
if ($rm == 10){
mysql_query ("Update users set posts='".$posts."', onl='".$time."' where id ='".$id."'");
} else {
mysql_query ("Update users set posts='".$posts."', onl='".$time."', room='".$rm."' where id ='".$id."'");
}
$hid = $row["inv"];
$kol++;
$rnd = rand(0,99999999);
if ($rm == 10){
@mysql_query ("Insert into room10 set klu4= '".$rnd."', time='".$today."', who='".$us."', message='".$msg."', messagewosm = '".$msg_wosm."', messagewoasm = '".$msg_woasm."', id='".$time."', towhom='".$towhom."', hid='".$hid."', usid='".$id."', pwd='".$pwd."'");
} else {
@mysql_query ("Insert into $room set klu4= '".$rnd."', time='".$today."', who='".$us."', message='".$msg."', messagewosm = '".$msg_wosm."', messagewoasm = '".$msg_woasm."', id='".$time."', towhom='".$towhom."', hid='".$hid."', usid='".$id."'");
}
$usmes["time"] = $today;
$usmes["who"] = $us;
$usmes["usid"] = $id;
$usmes["message"] = stripslashes($msg);
@$usmes["messagewosm"] = stripslashes($msg_wosm);
@$usmes["messagewoasm"] = stripslashes($msg_woasm);
$usmes["id"] = $time;
$usmes["towhom"] = $towhom;
$smthwr = 1;
if($rm==0)require("syst/umnik2.php");
}
}
if($row['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
$avr = $row["avr"];
$time=date ("H:i");
if($rm==10) $takep="&ref=$ref&pwd=$pwd";
else $takep="&ref=$ref";
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
if ($avr!==0) echo "<card id=\"chat\" title=\"$topic-$time\" ontimer=\"chat.php?id=$id&ps=$ps&rm=$rm$takep\"><timer value=\"$avr\"/>";
else echo "<card id=\"chat\" title=\"$topic-$time\" >";
echo "<do type=\"options\" name=\"refresh\" label=\"Обновить\"><go href=\"chat.php?id=$id&ps=$ps&rm=$rm$takep\"/></do>";
echo "<do type=\"options\" name=\"add\" label=\"Сказать\"><go href=\"#add\"/></do>";
$r = mysql_query ("select count(readd) as num from zapiski WHERE (idtowhom = '".$id."')and(readd = '0')and(ininc = '1')");
$a = mysql_fetch_array($r);
$inb = $a["num"];
echo "<do type=\"options\" name=\"mes\" label=\"Записки($inb)\"><go href=\"chatmail.php?id=$id&ps=$ps&rm=$rm&ref=$ref\"/></do>";
echo "<do type=\"options\" name=\"who\" label=\"Кто где?\"><go href=\"who.php?id=$id&ps=$ps&rm=$rm$takep\"/></do>";
echo "<do type=\"options\" name=\"enter\" label=\"Прихожая\"><go href=\"enter.php?id=$id&ps=$ps&rm=$rm$takep\"/></do>";
if ($rm==0) echo "<do type=\"options\" name=\"kom\" label=\"Команды\"><go href=\"faq.php?id=$id&ps=$ps&rm=$rm&ref=$ref&mod=vict_kom\"/></do>";
if ($rm==0) echo "<do type=\"options\" name=\"stats\" label=\"Статистика\"><go href=\"faq.php?id=$id&ps=$ps&rm=$rm&mod=10ym&ref=$ref\"/></do>";
if ($rm==10) echo "<do type=\"options\" name=\"klu4\" label=\"Сменить ключ\"><go href=\"intim.php?id=$id&ps=$ps&ref=$ref\"/></do>";
if (($row["level"]>3)&&($rm!=10)) echo "<do type=\"options\" name=\"topic\" label=\"РўРѕРїРёРє\"><go href=\"topic.php?id=$id&ps=$ps&rm=$rm$takep\"/></do>";
echo "<p>";
echo $fsize1;
if ($rm==10) {
///Запись в файл
$fi = fopen("syst/intim.dat", "a+");
$dat = date ("(H:i)d F");
$lst = " $dat::::$us in intim pass=$pwd time-$dat";
fwrite($fi, "$lst\n");
fwrite($fi, "************\n");
fflush($fi);
fclose($fi);
//Конец записи
echo "Здесь сейчас:";
$tim = time()-300;
$ress = mysql_query ("Select who,hid,pwd from room10 WHERE (id > '".$tim."') and ((pwd = '".$pwd."')OR(pwd = '')) group by who order by id desc");
$kol = mysql_affected_rows();
$liness = mysql_fetch_array ($ress);
for ($k = 1; $k < $kol; $k++)
{
$liness = mysql_fetch_array ($ress);
$userr = $liness["who"];
echo "$userr";
if (($k+1) != $kol) print ', ';
}
if($kol>1)
echo "<br/>";
unset($liness);
echo "<br/>";
}
echo "<small><a href=\"#add\">Сказать</a></small><br/>";
echo "<small><a href=\"chat.php?id=$id&ps=$ps&rm=$rm$takep\">Обновить</a></small>";
@$total=$kol-1;
$ignor = $row["ignor"];
$mread = 0;
if ($smthwr != 0)
{
$date = $usmes["time"];
$name = $usmes["who"];
$usid = $usmes["usid"];
$msg = $usmes["message"];
if ($smset==0&&$usmes["messagewosm"]!="") $msg = $usmes["messagewosm"];
if ($smset==2&&$usmes["messagewoasm"]!="") $msg = $usmes["messagewoasm"];
$time = $usmes["id"];
$th = $usmes["towhom"];
if (strpos($ignor, $name."|") === false)
{
if ($th == "")
{
$msg = str_replace($us.",", "<u>".$us."</u>,", $msg);
echo "<br/><b><small><a href=\"inside.php?id=$id&ps=$ps&rm=$rm&nk=$usid$takep\">$name</a></small></b><small>($date)<b>>></b>$msg</small>"; $mread++;
}
else if (($th == $id)||($id == $usid))
{
$msg = str_replace($us.",", "<u>".$us."</u>,", $msg);
echo "<br/><b><small><a href=\"inside.php?id=$id&ps=$ps&rm=$rm&nk=$usid$takep\">$name</a></small>[P!]</b><small>($date)<b>>></b>$msg</small>"; $mread++;
}
}
}
while ($mread < $max)
{
$lines = mysql_fetch_array ($res);
if($lines===false)break;
$date = $lines["time"];
$name = $lines["who"];
$usid = $lines["usid"];
$msg = $lines["message"];
if ($smset==0&&$lines["messagewosm"]!="") $msg = $lines["messagewosm"];
if ($smset==2&&$lines["messagewoasm"]!="") $msg = $lines["messagewoasm"];
$time = $lines["id"];
$th = $lines["towhom"];
$hid = $lines["hid"];
if ((strpos($ignor, $name."|") === false)&&(($hid != 2)||($id == $usid)))
{
if ($th == "")
{
$msg = str_replace($us.",", "<u>".$us."</u>,", $msg);
echo "<br/><b><small><a href=\"inside.php?id=$id&ps=$ps&rm=$rm&nk=$usid$takep\">$name</a></small></b><small>($date)>$msg</small>";$mread++;
} else
{
if (($th == $id)||($id == $usid))
{
$msg = str_replace($us.",", "<u>".$us."</u>,", $msg);
echo "<br/><b><small><a href=\"inside.php?id=$id&ps=$ps&rm=$rm&nk=$usid$takep\">$name</a></small>[P!]</b><small>($date)>$msg</small>";$mread++;
}
}
}
}
mysql_close ($link);
$page_next = $max;
echo "<br/><small><b>---</b></small>";
if ($max < $total)
{
echo "<br/><small><a href=\"history.php?id=$id&ps=$ps&rm=$rm&num=$page_next$takep\">Р?стория</a></small>";
}
echo "<br/><small><a href=\"enter.php?id=$id&ps=$ps&ref=$ref\">Прихожая</a></small>";
//list($msec,$sec)=explode(chr(32),microtime());echo "<br/>[".round(($sec+$msec)-$HeadTime,4)." sec]";
echo $fsize2;
echo "</p></card>";
echo "<card id=\"add\" title=\"Сказать\">";
echo "<p>";
echo "<input name=\"msg$ref\" maxlength=\"200\" title=\"Text\"/><br/>";
if (($row["translit"]==1)&&($room!="room0")){
echo "<select multiple=\"true\" name=\"translit\">\n";
echo "<option value=\"1\">Translit</option></select><br/>\n";
}
if ($row["level"]>=6) {
echo '<select multiple="true" name="bold"><option value="1">Жирный</option></select><br/>';
}
if ($row["level"]>=4) {
echo '<select multiple="true" name="underline"><option value="1">Подчеркнутый</option></select><br/>';
}
echo "<anchor title=\"send\">Сказать<go href=\"chat.php?id=$id&ps=$ps&rm=$rm$takep\" method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg$ref)\"/>";
echo "<postfield name=\"bold\" value=\"$(bold)\"/>\n";
echo "<postfield name=\"underline\" value=\"$(underline)\"/>\n";
echo "<postfield name=\"translit\" value=\"$(translit)\"/>\n";
echo "</go></anchor><br/>";
echo "<a href=\"chat.php?id=$id&ps=$ps&rm=$rm$takep\">В чат</a>";
echo "</p></card>";
echo "</wml>";
?>