<?php
session_start();

include('includes/ajax_check_login.php');

require_once('includes/common.php');

if( !isset($_POST['news_cate_name']) || !isset($_POST['order']) || ( $static_str_news_cate_name = process_quotes(strip_tags($_POST['news_cate_name'])) ) == '' || ( $static_uint_order = (int)$_POST['order'] ) < 0 || $static_uint_order > 255 )
	exit(json_encode(array('ErrCode'=>-1, 'ErrMessage'=>'輸入資料不足', 'RedirectURL'=>'')));

require_once('includes/admin.php');
$obj_class_admin = new class_admin();

if( !$obj_class_admin->add_news_cate($static_str_news_cate_name, $static_uint_order) )
	exit(json_encode(array('ErrCode'=>0, 'ErrMessage'=>'新增新聞類別失敗！', 'RedirectURL'=>'')));
else
	exit(json_encode(array('ErrCode'=>1, 'ErrMessage'=>'新增新聞類別成功', 'RedirectURL'=>'')));
?>