<?
include_once "../SYSTEM/include/functions.php";
include_once "../SYSTEM/include/mysql.php";
include_once "../SYSTEM/include/param.php";
include_once "../SYSTEM/include/ban.php";
include_once "../SYSTEM/include/sess.php";
include_once "../SYSTEM/include/ban_2.php";
include_once "../SYSTEM/include/theme.php";
$title='Закрыть тему';
$mesto='Закрывает тему в форуме';
head();

if (isset($_GET['page']))
{
$page=$_GET['page'];
}else{$page=1;}

if (!isset($_GET['id_forum']))
{
header ("Location: index.php?".SID."&");

exit;
}
if (!isset($_GET['id_forum']))
{
header ("Location: index.php?".SID."&");

exit;
}
$id_forum=intval($_GET['id_forum']);
$q = mysql_query("SELECT * FROM `$mysql[pref]forum_f` WHERE `id` = '$id_forum';");
if(mysql_num_rows($q) != 0)
{
$forum = mysql_fetch_array($q);
}
else
{
header ("Location: index.php?".SID."&");

exit;
}

if (!isset($_GET['id_razd']))
{
header ("Location: index.php?".SID."&id_forum=$id_forum");

exit;
}
$id_razd=intval($_GET['id_razd']);
$q = mysql_query("SELECT * FROM `$mysql[pref]forum_r` WHERE `id_f` = '$id_forum' AND `id` = '$id_razd';");
if(mysql_num_rows($q) != 0)
{
$razd = mysql_fetch_array($q);
}
else
{
header ("Location: index.php?".SID."&id_forum=$id_forum");

exit;
}

if (!isset($_GET['id_them']))
{
header ("Location: index.php?".SID."&id_forum=$id_forum&id_razd=$id_razd");

exit;
}
$id_them=intval($_GET['id_them']);
$q = mysql_query("SELECT * FROM `$mysql[pref]forum_t` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id` = '$id_them';");
if(mysql_num_rows($q) != 0)
{
$thema = mysql_fetch_array($q);
}
else
{
header ("Location: index.php?".SID."&id_forum=$id_forum&id_razd=$id_razd");

exit;
}




if (!isset($user) || $user['id']!=$thema['id_us'])
{
header ("Location: index.php?".SID."&id_forum=$id_forum&id_razd=$id_razd&id_them=$id_them&amp;page=$page");

exit;
}

if (isset($_GET['act']) && $_GET['act']=='set')
{

mysql_query("UPDATE `$mysql[pref]forum_t` SET `close` = '1', `nick_close` = '$user[nickname]' WHERE `id` = '$id_them';");

header("Location: index.php?".SID."&act=set&id_forum=$id_forum&id_razd=$id_razd");

exit;

}



echo "<div class=\"h\">Закрыть тему ".base64_decode($thema['name'])."?</div><hr />\n";

echo "<a href=\"close.php?act=set&amp;id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=$page\">Подтверждаю</a><br />\n";



echo "<hr />";
echo "<a href=\"index.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=end\">В тему</a>\n";
echo "<br /><a href=\"../index.php\">На главную</a>\n";

foot();
?>
