File size: 3.2Kb
<?php
/*
*Manag-Develop BolCmS-Suptesat
*Syte- bolcms.cf
*/
$title = 'Админка';
require("../system/core.php");
if($_SESSION['id'] != '1'){header("location: ../"); exit();}
switch($_GET['act']){
default:
echo '<div class="phdr">' .$lng ['razdel'] . ' </div><div class="bmenu">';
$result = mysql_query("SELECT * FROM `forum_cats`");
$row = mysql_fetch_assoc($result);
if($row > 0){
do
{
printf('<a href="../forum/index.php?act=cat_view&id=%s">%s</a> (<a href="?act=cat_edit&id=%s">' .$lng ['edit'] . ' </a>/<a href="?act=cat_del&id=%s">' .$lng ['del'] . ' </a>)<br/>', $row['id'], $row['name'], $row['id'], $row['id']);
}
while($row = mysql_fetch_assoc($result));
}else{
echo ' ' .$lng ['fno'] . ' <br/>';
}
echo '<br/><form action="?act=cat_added" method="post" name="form">';
echo '<input name="name" type="text" maxlength="50"><br/>';
echo '<input name="submit" type="submit" value="' .$lng ['adraz'] . ' "></form></div>';
echo '<div class="phdr"></div><div class="bmenu"><a href="./">' .$lng ['det'] . ' </a><br/><a href="../">' .$lng ['niz'] . ' </a></div>';
break;
case 'cat_added':
if(!empty($_POST['name'])){
$name = sec($_POST['name']);
mysql_query("INSERT INTO `forum_cats`(`name`) VALUES('$name')");
info('' .$lng ['suc'] . ' ');
nav2('forum.php', '' .$lng ['det'] . ' ');
}else{
error(' ERROR ');
nav2('forum.php', ' ' .$lng ['nd'] . ' ');
}
break;
case 'cat_edit':
$id = intval($_REQUEST['id']);
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_cats` WHERE `id` = '$id'"));
echo '<div class="phdr">' .$lng ['edir'] . ' </div><div class="bmenu">';
echo '<form action="?act=cat_edited&id='.$id.'" method="post" name="form">';
echo ' ' .$lng ['natrl'] . ' :<br/><input name="name" type="text" maxlength="50" value="'.$row['name'].'" /><br/>';
echo '<input name="submit" type="submit" value=" ' .$lng ['edit'] . ' " /></form></div>';
nav2('forum.php', 'назад');
break;
case 'cat_edited':
$id = intval($_REQUEST['id']);
if(!empty($_POST['name'])){
$name = sec($_POST['name']);
mysql_query("UPDATE `forum_cats` SET `name` = '$name' WHERE `id` = '$id'");
info(' ' .$lng ['vlv'] . ' !');
nav2('forum.php', ' ' .$lng ['nd'] . ' ');
}else{
error(' ' .$lng ['edtd'] . ' !');
nav2('?act=cat_edit&id='.$id.'', ' ' .$lng ['nd'] . ' ');
}
break;
case 'cat_del':
$id = intval($_REQUEST['id']);
$result = mysql_query("DELETE FROM `forum_cats` WHERE `id` = '$id'");
if($result == true){
info(' ' .$lng ['vlv'] . ' !');
nav2('forum.php', ' ' .$lng ['nd'] . ' ');
}else{
error(' ' .$lng ['error'] . ' !');
nav2('forum.php', ' ' .$lng ['nd'] . ' ');
}
break;
case 'msg_del':
$topic_id = intval($_REQUEST['topic_id']);
$id = intval($_REQUEST['id']);
$result = mysql_query("DELETE FROM `forum_msg` WHERE `id` = '$id'");
if($result == true){
info(' ' .$lng ['vlv'] . ' !');
nav2('../forum/topic.php?id='.$topic_id.'', ' ' .$lng ['nd'] . ' ');
}
break;
case 'topic_del':
$id = intval($_REQUEST['id']);
$result = mysql_query("DELETE FROM `forum_topics` WHERE `id` = '$id'");
$result2 = mysql_query("DELETE FROM `forum_msg` WHERE `id_topic` = '$id'");
info(' ' .$lng ['vlv'] . ' !');
nav2('../forum/index.php', ' ' .$lng ['forum'] . ' ');
break;
}
require("../system/end.php");
?>