<?
if(time()<$row['kik']){
$re = mysql_query("SELECT name FROM rooms where rm = '9'");
$inam = mysql_fetch_array ($re);
$nam = $inam['name'];
$tyu='center';
$title="Стоп!";
head();
echo $fs1;
$tleft = $row['kik'] - time();
$tleft=ceil($tleft/ 60 / 60 / 24);
$whokik = $row['whokik'];
$whykik = $row['whykik'];
echo $div1.'<b>Ошибка!</b>'.$div9;
echo "<br />Вам запрещенно писать <b>".$tleft." дней</b><br/>";
echo "Причина: <b>".$whykik."</b><br/><br />";
echo $div1.'<a href="'.H2.'enter.php">На главную</a>'.$div9;
foot();
exit;
}

echo $fs1;
$mess0 = @mysql_query( @"select  *  from  `forum_message`  where `id`='".$m."';" );
$mess = @mysql_fetch_array($mess0);
if (mysql_affected_rows() == 0){
echo $fs1;
echo '<b>Такого сообщения не существует!</b>';
echo $fs2;
foot();
exit;
}
$id = $mess ['topic'];

$q1 = @mysql_query( @"select  *  from  `forum_topic` where `id`='".$id."' ;" );
$topic = @mysql_fetch_array(@$q1);
if (mysql_affected_rows() == 0){
echo $fs1;
echo '<b>Такой темы не существует!</b>';
echo $fs2;
foot();
exit;
}

if (($row['id']!=$mess['login'])&&($row['level']<5)){
echo '<b>Вы не можете изменять это сообщение!</b>';
echo '<br />';
foot();
exit();
}

$f = $topic ['section'];
$sf = $topic ['subfor'];


$que = @mysql_query( "select * from  `forum_subfor` where id='$sf';" );
$dtm = @mysql_fetch_array( @$que );
$s_name = $dtm['name'];

$que = @mysql_query( "select * from  `forum_sections` where id='$f';" );
$dtm = @mysql_fetch_array( @$que );
$f_name = $dtm['name'];

echo "<dl><dt></dt></dl><a href=\"".F."\">Форумы</a>|<a href=\"".F."subfs/$f\">$f_name</a>";
echo "|<a href=\"".F."temes/$sf\">$s_name</a>|<a href=\"".F."tema/$id/$page\">".$topic ['name']."</a><br /><dl><dt></dt></dl>";

$q2 = @mysql_query("SELECT * from `forum_message` WHERE `id` = '".$m."'");
$k = mysql_num_rows( $q2 );




$q1 = @mysql_query( @"select  *  from  `forum_topic`  where `id`='".$id."' and subfor = '".$sf."' ;" );
$topic = @mysql_fetch_array( @$q1 );
if ($topic['close']==0)
{


$q2 = @mysql_query( @"select * from  `users` WHERE id = '$nk' ;" );
$sect2 = @mysql_fetch_array( @$q2 );


if (empty($act)){



if ($wap==2||$wap==3) echo "<form form method=\"post\" enctype=\"multipart/form-data\" action=\"\">";
echo "Сообщение:<br/>";
echo'<textarea cols="60" rows="4" name="msg" >'.output_text($mess['msg'],false,true,false,false,false).'</textarea><br />';
echo "<input type=\"hidden\" name=\"f\" value=\"$f\"/>";
echo "<input type=\"hidden\" name=\"sf\" value=\"$sf\"/>";
echo "<input type=\"hidden\" name=\"t\" value=\"$id\"/>";
echo "<input type=\"hidden\" name=\"nk\" value=\"$nk\"/>";
echo "<input type=\"hidden\" name=\"mod\" value=\"$mod\"/>";
echo "<input type=\"hidden\" name=\"m\" value=\"$m\"/>";
echo "<input type=\"hidden\" name=\"act\" value=\"act\"/>";
echo "<input type=\"hidden\" name=\"page\" value=\"$page\"/>";
if ($wap=="1"){
echo $fs1;
echo "<anchor title=\"go\">Изменить<go href=\"\" method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo "<postfield name=\"file\" value=\"$(file)\"/>";
echo "<postfield name=\"f\" value=\"$f\"/>";
echo "<postfield name=\"m\" value=\"$m\"/>";
echo "<postfield name=\"sf\" value=\"$sf\"/>";
echo "<postfield name=\"t\" value=\"$id\"/>";
echo "<postfield name=\"nk\" value=\"$nk\"/>";
echo "<postfield name=\"mod\" value=\"$mod\"/>";
echo "<postfield name=\"act\" value=\"act\"/>";
echo "<postfield name=\"page\" value=\"$page\"/>";
echo "</go></anchor>";
echo $fs2;
echo "<br/>";
}else{
echo "<input type=\"submit\" class=\"ibutton\" value=\"Изменить\" class=\"cp\"><br /><br />";
}

echo "<br /><br /><img src=\"".H2."img/naz.gif\" alt=\"[N]\"/> <a href=\"?mod=temes&amp;f=$f&amp;sf=$sf&amp;t=$id&amp;mod=tema&amp;page=end\"><b>В тему</b></a><br />";
}else{
$mess['izmk']++;
$izm = "<br /><font color=\"#800080\"><i>Изм: ".$row['user']." ".date("(d.m в H:i", time()).") [".$mess['izmk']."]</i></font>";
$msg = check($_POST['msg']);
if ($row["translit"]==1) $msg = translit($msg);

mysql_query("UPDATE `forum_message` SET `msg` = '$msg', `izm` = '$izm', `izmk` = '".$mess['izmk']."' where `id`='".$m."' LIMIT 1");

header("Location: ".F."tema/$id/$page");

}
}


echo $fs2;

?>