<?

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']<2)

{

header ("Location: index.php");


exit;

}



if (!isset($_GET['id_forum']))

{

header ("Location: index.php");


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

{

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

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

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

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

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

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_r` SET `name` = '$name', `num` = '$num' WHERE `id` = '$id_razd';");

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

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


exit;



}











echo "<div class=\"h\">Настройки раздела $razd[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 "<div class=\"menu\">";

echo "<div class=\"title\">Параметры раздела</div>";

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





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

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

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

echo "</form>\n";


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

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

echo "</form>\n";

echo "</div>";

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

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


foot();

?>

