Просмотр файла chat/set_r.php

Размер файла: 2.74Kb
<?
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_r=intval($_GET['id_r']);
$q = mysql_query("SELECT * FROM `$mysql[pref]chat_room` WHERE `id` = '$id_r';");
if(mysql_num_rows($q) != 0)
{
$room = mysql_fetch_array($q);
}
else
{
header ("Location: index.php?".SID."&");

exit;
}

if (isset($_GET['act']) && $_GET['act']=='set')
{
if (isset($_POST['del']) && $_POST['del']==1)
{
mysql_query("DELETE FROM `$mysql[pref]chat_room` WHERE `id` = '$id_r';");
mysql_query("DELETE FROM `$mysql[pref]chat` WHERE `id_r` = '$id_r';");
header("Location: index.php?".SID."&act=set");

exit;
}

if (!isset($_POST['num']) || $_POST['num']=='')
{
$num=1;
}
else
{
$num=intval($_POST['num']);
}


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

mysql_query("UPDATE `$mysql[pref]chat_room` SET `name` = '$name', `num` = '$num', `umnik` = '$umn', `shut` = '$shut' WHERE `id` = '$id_r';");

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

exit;


}




echo "<div class=\"h\">Настройки комнаты $room[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 "<br /><form method=\"post\" action=\"set_r.php?act=set&amp;id_r=$id_r\">\n";


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

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

$check1='';
$check2='';
if ($room['umnik']){$check1=' checked="true"';}
if ($room['shut']){$check2=' checked="true"';}

echo "<input type=\"checkbox\" name=\"um\" value=\"1\"$check1 /> Умник<br />\n";

echo "<input type=\"checkbox\" name=\"sh\" value=\"1\"$check2 /> Шутник<br />\n";

echo "<input type=\"checkbox\" name=\"del\"  value=\"1\" />";
echo " Удалить форум<br />\n";

echo "<br /><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>\n";

foot();
?>