<?
$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;
}
$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>";

$q1 = @mysql_query( @"select  *  from  `forum_topic`  where `id`='".$id."' and subfor = '".$sf."' ;" );
$topic = @mysql_fetch_array(@$q1);
if ($topic['login']!=$myid)
{   echo $fs1;
echo "Доступ закрыт!<br /><a href=\"./?f=".$f."&amp;sf=$sf&amp;sf=".$sf."&amp;t=".$id."&amp;mod=tema&amp;page=end\">В Тему</a><br/>";
echo $fs2;
}
else
{

if ( mysql_query( "Update forum_topic set close='1' where id ='".$id."'" ) )
        {   echo $fs1;
            $msg = "Тема закрыта для обсуждения!";
            echo $fs2;
$add = "Insert into forum_message set topic='".$id."', login ='".$row['id']."', msg='".$msg."',time='".time()."', section='".$f."', subfor = '".$sf."'";
if (mysql_query($add))
{   }
        }
echo "<div>{$msg}</div>";
header("Location: ".F."tema/$id/$page");}
?>