<?
##################################################################################################
## Made by Neformat Modifikacion Vanich ; Chat Name Real Чат (с)
##################################################################################################
header("Cache-Control: no-cache");
if ($ver=="wml")header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require("inc.php");
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require("version.php");
if($row["level"] < 6) {
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<card id=\"error\" title=\"Ошибка доступа\">\n";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Ошибка доступа</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body><div class=\"zero\">";
}
echo $fsize1;
echo "У вас нет прав доступа!\n";
echo $fsize2;
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
}
if($rm==10) $takep="&pwd=$pwd&ref=$ref";
else if($mod=="privat") $takep="&mod=$mod&ref=$ref";
else $takep="&ref=$ref";
if(!isset($go)){
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"topic\" title=\"Изменить топик\">\n";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Изменить топик</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body><div class=\"news\">";
echo "<form method=\"POST\" action=\"topic.php?go=nt&$ses&rm=$rm$takep\" name=\"auth\">\n";
}
echo $fsize1;
echo "Новый топик:<br/>\n";
if($ver=="xhtml"){ echo "<br/></div><div class=\"zero\">";}
echo $fsize2;
echo "<input name=\"newtop\" maxlength=\"30\" value=\"\" title=\"change\"/><br/>\n";
if ($ver=="wml"){
echo $fsize1;
echo "<anchor title=\"go\">Изменить!<go href=\"topic.php?go=nt&$ses&rm=$rm$takep\" method=\"post\">\n";
echo "<postfield name=\"newtop\" value=\"$(newtop)\"/>\n";
echo "</go></anchor>";
echo $fsize2;
}else{
echo "<input class=\"ibutton\" type=\"submit\" value=\"Изменить!\" name=\"enter\"><br/>\n";
}
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
}
function trun_to_topic($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;
}
if($row["translit"]==1) {$newtop=trun_to_topic($newtop);}
if ($ver=="wml"){
echo $xml;
echo $dtd;
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"changed\" title=\"Топик сменен\" ontimer=\"chat.php?$ses&rm=$rm$takep\"><timer value=\"10\"/>\n";
echo "<p align=\"center\">\n";
}else{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Топик сменён</title>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=chat.php?$ses&rm=$rm$takep\">";
if($ver=="xhtml"){ echo "<br/></div><div class=\"news\">";}
}
echo $fsize1;
echo "Топик был изменен!<br/>\n";
echo $fsize2;
@$newtop = str_replace(chr("13"), " ", $newtop);
@$newtop = str_replace(chr("10"), " ", $newtop);
@$newtop = str_replace("\\n", " ", $newtop);
@$newtop = trim(" $newtop ");
@$newtop = ereg_replace(" +"," ",$newtop);
@$newtop=substr($newtop,0,60);
@$newtop = str_replace("$", "$$", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = str_replace("", "", $newtop);
@$newtop = HtmlSpecialChars($newtop);
@$newtop = str_replace("\"", """, $newtop);
@$newtop = str_replace("|", "¦", $newtop);
@$newtop = str_replace("'", "‘", $newtop);
@$newtop = str_replace("\\", "", $newtop);
@$newtop = addslashes($newtop);
mysql_query ("UPDATE rooms SET topic = '".$newtop."' WHERE rm = '".$rm."'");
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
exit;
?>