<?
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;
}
if (isset($_GET['act']) && $_GET['act']=='add' && isset($_POST['name']) && isset($_POST['num']))
{
$name=$_POST['name'];
$num=intval($_POST['num']);
if (isset($_POST['tr'])){$name=translit($name);}

$shut=0;
$umn=0;
if (isset($_POST['um'])){$umn=1;}
if (isset($_POST['sh'])){$shut=1;}

$name=stripslashes(htmlspecialchars($name));
mysql_query("INSERT INTO `$mysql[pref]chat_room` (name, num, umnik, shut)
values('$name', '$num', '$umn', '$shut')");
ball_add();
header("Location: index.php?".SID."&msg=add_r");

exit;
}





echo "<div class=\"h\">Добавить комнату</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=\"add_r.php?act=add\">\n";
echo "Название:<br />\n<input name=\"name\" class=\"form\" type=\"text\" /><br />\n";
echo "<input type=\"checkbox\" name=\"tr\" class=\"form\" value=\"1\" /> Транслит<br />\n";
echo "Позиция:<br />\n<input name=\"num\" class=\"form\" type=\"text\" value=\"1\" /><br />\n";

echo "<input type=\"checkbox\" class=\"form\" name=\"um\" value=\"1\" /> Умник<br />\n";
echo "<input type=\"checkbox\" class=\"form\" name=\"sh\" value=\"1\" /> Шутник<br />\n";
echo "<input value=\"Добавить\" class=\"form\" type=\"submit\" />\n";
echo "</form>\n";
echo "<br />\n";





echo "<a href=\"index.php\">Вернуться</a>\n";
echo "<br /><a href=\"../index.php\">На главную</a><br />\n";

foot();
?>
