Файл: region_clean/topic.php
Строк: 188
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
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_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
$us = $row['user'];
if ($row['level'] < 6) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<card id="error" title="Ошибка доступа">n
<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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Ошибка доступа</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
echo 'У тебя нет прав доступа!<br/>';
echo $fsize2;
include_once "foot.php";
exit;
}
if (isset($rm) and !ctype_digit($rm)) { header('Location: index.php?isset=403'); }
if ($rm == 10) $takep="&pwd=$pwd&ref=$ref";
else if($mod == "privat") $takep="&mod=$mod&ref=$ref";
else $takep="&ref=$ref";
$go = isset($_GET['go']) ? $_GET['go'] : NULL;
if (!isset($go)) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="topic" title="Изменить топик">n
<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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Изменить топик</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">
<form method="POST" action="topic.php?go=nt&$ses&rm=$rm$takep" name="auth">n";
}
echo $fsize1;
echo 'Новый топик:<br/>';
echo $fsize2;
echo '<input name="newtop" maxlength="25" value="" title="change"/><br/>';
if ($ver == "wml") {
echo $fsize1;
echo "<anchor title="go">Изменить<go href="topic.php?go=nt&$ses&rm=$rm$takep" method="post">n
<postfield name="newtop" value="$(newtop)"/>n
</go></anchor>";
echo $fsize2;
} else {
echo "<input type="submit" class="ibutton" value="Изменить" name="enter"><br/>n";
}
echo "<br/><a href="chat.php?$ses&rm=$rm$takep">В чат</a><br/>";
include_once "foot.php";
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 (mb_strlen($_POST['newtop'], 'UTF8') > 25) {
include_once 'obolochka.php';
echo 'Слишком много текста...<br/>';
include_once 'foot.php';
exit;
}
if (empty($_POST['newtop'])) {
include_once 'obolochka.php';
echo 'Напиши хоть пару строчег =)';
include_once 'foot.php';
exit;
}
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="changed" title="Топик сменен" ontimer="chat.php?$ses&rm=$rm$takep"><timer value="10"/>n
<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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Топик сменён</title>
<META HTTP-EQUIV="Refresh" CONTENT="2; URL=chat.php?$ses&rm=$rm$takep">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
echo 'Топик был изменен!<br/>';
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 = mb_substr($newtop,0,60,'UTF8');
$newtop = mysql_real_escape_string(check($newtop));
mysql_query("UPDATE rooms SET topic = '".$newtop."' WHERE rm = '".(int)$rm."'");
if ($row['translit'] == 1) $newtop = trun_to_rus($newtop);
$newtop = mb_substr($newtop,0,40,'UTF8');
$block = intval($block);
mysql_query("UPDATE rooms SET topic = '".$newtop."', block='".$block."' WHERE rm = '".(int)$rm."'");
$fit = fopen("log/topic.dat", "a+");
$dat = date ("d/m/y");
$vrem = date ("H:i");
$qr = mysql_query("select name from rooms where rm=$rm");
$mfa = mysql_fetch_array($qr);
$top_room = $mfa['name'];
$us = $row['user'];
$lstt = "<b>".$us."</b> ($dat $vrem $top_room) - <b>".$newtop."</b><br/>";
fwrite($fit, "$lsttn");
fwrite($fit, "*n");
fflush($fit);
fclose($fit);
$adm = mysql_query("Select user from users where id='1' LIMIT 1;");
$z = mysql_fetch_array($adm);
$administration = $z['user'];
$administration = check($administration);
$time = time();
$rnd = mt_rand(0,99999999);
$today = date ("H:i");
$time = time();
if ($row['sex'] == 'М') {
$new = 'сменил';
} else {
$new = 'сменила';
}
$txt = '<b>'.col_n($us).'</b> ' . $new . ' топик на: <b>' . $newtop . '</b>.';
for ($num = 0; $num < 22; $num++) {
$room = "room" . $rm;
mysql_query ("Insert into $room set klu4= '".$rnd."', time='".$today."', who='".$administration."', message='".$txt."', id='".$time."', towhom='', hid='0', usid='1', komu=''");
}
include_once "foot.php";
exit;
?>