Просмотр файла blog/distribution/management.php

Размер файла: 4.51Kb
<?
#-----------------------------------------------#
#             	Аuthor:  Nu3oN                  #
#                  ICQ : 100-50-97              #
#-----------------------------------------------#

if (is_user() and is_admin(array(101,102)))
{


if (isset($_POST['UndoAction']) and $_POST['UndoAction'])
{
header ('Location: '.$config['home'].'/blog/?'.SID); die;
}


///////////////////////////////////////////////


if (isset($_GET['add_razdel']))
{
if ($_SESSION['ners'] == false) $_SESSION['ners'] = true; else $_SESSION['ners'] = false;

header('Refresh: 1; url='.$config['home'].'/blog/index.php?'.SID);
outputMessage(' Админка успешно '.($_SESSION['ners'] == false ? 'выключена' : 'включена').' ');
echo '<div> В <a href="index.php?"> блог</a> <br /> На <a href="../index.php?"> главную</a> </div> ';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;


}

///////////////////////////////////////////////////

if (isset($_POST['submit_new_category']) and $_POST['submit_new_category']):

if ((iconv_strlen($_POST['name_new_category'], 'UTF-8') > 3) and (iconv_strlen($_POST['name_new_category'], 'UTF-8') < 25)):
if ((iconv_strlen($_POST['desc_new_category'], 'UTF-8') > 5) and (iconv_strlen($_POST['desc_new_category'], 'UTF-8') < 150)):


$_checkAdd = mysql_query("INSERT INTO `blog_categories` SET 
`name_category_blog` = '".check($_POST['name_new_category'])."',
`comm_category_blog` = '".no_br(check($_POST['desc_new_category']), '<br />')."'");

if (trim($_checkAdd))
{
header('Refresh: 1; url='.$config['home'].'/blog/index.php?'.SID);
outputMessage(' Раздел успешно создан ');
echo '<div> В <a href="index.php?'.SID.'"> блоги</a> <br /> На <a href="../index.php?'.SID.'"> главную</a> </div> ';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;
}
else
{
outputMessage(' Error writing to database ', 'err');
}

else: outputMessage(' Недопустимое количество символов в описании ', 'err'); endif;
else: outputMessage(' Недопустимое количество символов в названии ', 'err'); endif;

endif;

///////////////////////////////////////////////////

if (isset($_GET['deleteCat']) and isset($_GET['deleteCat'])):


if (isset($_POST['del_yes']))
{
$_checkDel = mysql_query("DELETE FROM `blog_categories` WHERE `id` = '".$_delCat."'");
mysql_query("DELETE FROM `blog_comments` WHERE `id_category` = '".$_delCat."'");
mysql_query("DELETE FROM `blog_vote` WHERE `id_category` = '".$_delCat."'");
mysql_query("DELETE FROM `directly_blogs` WHERE `id_blog_category` = '".$_delCat."'");
if (trim($_checkDel))
{
header('Refresh: 1; url='.$config['home'].'/blog/index.php?'.SID);
outputMessage(' Раздел успешно удален ');
echo '<div> В <a href="index.php?"> блог</a> <br /> На <a href="../index.php?"> главную</a> </div> ';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;
}
else
{
outputMessage(' Error writing to database ', 'err');
}
}
else
{
$_formOut = 'delete';
}

endif;




///////////////////////////////////////////////////



if (isset($_GET['editeCat']) and isset($_GET['editeCat'])): if (isset($_POST['SubEdite']) and isset($_POST['SubEdite'])):

if ((iconv_strlen($_POST['name_edit_category'], 'UTF-8') > 3) and (iconv_strlen($_POST['name_edit_category'], 'UTF-8') < 25)):
if ((iconv_strlen($_POST['desc_edit_category'], 'UTF-8') > 5) and (iconv_strlen($_POST['desc_edit_category'], 'UTF-8') < 150)):


mysql_query("UPDATE `blog_categories` SET 
`name_category_blog` = '".check($_POST['name_edit_category'])."', 
`comm_category_blog` = '".check($_POST['desc_edit_category'])."'
WHERE `id` ='".$_editCat."'");


header('Refresh: 1; url='.$config['home'].'/blog/index.php?'.SID);
outputMessage(' Раздел успешно отредактирован! ');
echo '<div> В <a href="index.php?"> блог</a> <br /> На <a href="../index.php?"> главную</a> </div> ';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;


else: outputMessage(' Недопустимое количество символов в описании ', 'err'); endif;
else: outputMessage(' Недопустимое количество символов в названии ', 'err'); endif;
endif;


$_QueryCat = mysql_fetch_array(mysql_query("SELECT * FROM `blog_categories` WHERE `id` = '".$_editCat."'"));
$_formOut = 'edite';
endif;




}


?>