<?php
require_once '../../library/config.php';


if (isset($_POST['cat_id'])){
	$id = $_POST['cat_id'];
	$value = $_POST['input_val'];
	$brief = $_POST['input_brief'];
	mysql_query("UPDATE cate SET cat_name = '$value', cp_cat_name = '$brief' WHERE cat_id = '$id'", $connePaper);
}

if (isset($_POST['subcat_id'])){
	$id = $_POST['subcat_id'];
	$value = $_POST['input_val'];
	mysql_query("UPDATE subcate SET subcat_name = '$value' WHERE subcat_id = '$id'", $connePaper);
}

if (isset($_POST['match_cat_id'])){
	$id = $_POST['match_cat_id'];
	$value = $_POST['input_val'];
	mysql_query("INSERT INTO subcate (match_cat_id, subcat_name) VALUES ('$id', '$value')", $connePaper);
}

if (isset($_POST['add_cate'])){
	$value = $_POST['input_val'];
	mysql_query("INSERT INTO cate (cat_name, rank) VALUES ('$value', 99)", $connePaper);
}



?>
<b style="color:red;">更新成功!!</b>
<script type="text/javascript">
	setTimeout(function(){location.reload()}, 1000);
</script>