Файл: region_clean/top.php
Строк: 194
<?
#######################################
## 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 (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 class="news">
<form method="POST" action="top.php?go=nt&$ses&rm=$rm$takep" name="auth">n";
}
$re = mysql_fetch_array(mysql_query("Select money,posts from users where id='$id' LIMIT 1;"));
$monets = $re['money'];
echo $fsize1;
echo 'У тебя : <font color="green"><b>'.$monets.' рублей</b></font><br/>
Введи текст топика:<br/>';
echo $fsize2;
echo '<input name="newtop" maxlength="25" value="" title="change"/><br />';
if ($ver == "wml") {
echo $fsize1;
echo "<anchor title="go">Изменить<go href="top.php?go=nt&$ses&rm=$rm$takep" method="post">n
<postfield name="newtop" value="$(newtop)"/>n
</go></anchor>";
echo $fsize2;
} else {
echo "<input class="ibutton" type="submit" value="Изменить" name="enter"><br/>n
<div class = 'd1'><a href="mag.php?$ses&ref=$ref">Магазин</a><br/>n
<a href="enter.php?$ses&ref=$ref">Прихожая</a></div>";
}
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 ($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>";
}
if (mb_strlen($_POST['newtop'], 'UTF8') > 25) {
include_once 'obolochka.php';
echo 'Слишком много текста...<br/>';
include_once 'foot.php';
exit;
}
if ($_POST['newtop'] == '') {
echo 'Ошибка!<br />';
echo "<div class = 'd1'><a href="mag.php?$ses&ref=$ref">Магазин</a><br />n
<a href="enter.php?$ses&ref=$ref">Прихожая</a></div>";
}
else
{
echo 'Топик был изменен!<br />';
echo "<div class = 'd1'><a href="mag.php?$ses&ref=$ref">Магазин</a><br />n
<a href="enter.php?$ses&ref=$ref">Прихожая</a></div>";
if ($ver == "xhtml") {
echo '</div>';
}
$r = mysql_fetch_array(mysql_query("Select money from users where id='$id' LIMIT 1;"));
$m = $r['money'];
$baks = $m - 30;
$baks = intval($baks);
mysql_query("update `users` set money='$baks' WHERE `id` = '$id'");
@$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 = 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 = '".mysql_real_escape_string(check($newtop))."' 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='".(int)$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 = 'сменил';
$iz = '(с магазина)';
} else {
$new = 'сменила';
$iz = '(с магазина)';
}
$txt = '<b>' . col_n($us) . '</b> <font color="red">' . $iz . '</font> ' . $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";
mysql_close ($link);
exit;
?>