<?

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($user) || $user['level']<3)

{

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['act']) && $_GET['act']=='del')

{

mysql_query("DELETE FROM `$mysql[pref]forum_f` WHERE `id` = '$id_forum';");

mysql_query("DELETE FROM `$mysql[pref]forum_r` WHERE `id_f` = '$id_forum';");

mysql_query("DELETE FROM `$mysql[pref]forum_t` WHERE `id_f` = '$id_forum';");

mysql_query("DELETE FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum';");

action("Удаление подфорума");

header("Location: index.php?".SID."&act=del");

exit;

}




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

{

if (!isset($_POST['num']) || $_POST['num']=='')

{

$num=1;

}

else

{

$num=intval($_POST['num']);

}




$name=$_POST['name'];

$name=stripslashes(htmlspecialchars($name));

$name=$name;


mysql_query("UPDATE `$mysql[pref]forum_f` SET `name` = '$name', `num` = '$num' WHERE `id` = '$id_forum';");

action("Изменение подфорума");

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


exit;



}





echo "<div class=\"h\">Настройки форума $forum[name]</div><hr />\n";


if ($mail_in_new>0)echo "<div class=\"privat\"><img src=\"../SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> <a href=\"../mail.php?act=in\">Приват</a> [$mail_in_new]</div><hr />\n";


echo "<form method=\"post\" action=\"set_f.php?act=set&amp;id_forum=$id_forum\">\n";

echo "<b>Параметры</b>";

echo "<br />\n";

echo "Название:<br />\n<input name=\"name\" class=\"form\" type=\"text\" value=\"$forum[name]\" /><br />\n";

echo "Позиция:<br />\n<input name=\"num\" class=\"form\" type=\"text\" value=\"$forum[num]\" /><br />\n";

echo "<input value=\"Изменить\" class=\"form\" type=\"submit\" />\n";

echo "</form>\n";

echo "<form method=\"post\" action=\"set_f.php?act=del&amp;id_forum=$id_forum\">\n";

echo "<input value=\"Удалить\" class=\"form\" type=\"submit\" />\n";

echo "</form>\n";






echo "<a href=\"index.php\">Вернуться</a>\n";

echo "<br /><a href=\"../index.php\">На главную</a>\n";


foot();

?>

