<%@page contentType="text/html; charset=UTF-8"%>
<%@include file="/inc/init.jsp"%>
<%@include file="/inc/checklogin.jsp"%>
<%
	String action = pu.getString("action");
	String referer=pu.referer();
	Comment_db cmdb = new Comment_db();
	int commentid = pu.getInt("commentid");
	String name = pu.getString("username");
	String content = pu.getString("content");
	int classid = pu.getInt("classid");
	int type = pu.getInt("type");
	int state = pu.getInt("state");
	String ip = pu.getString("ip");
	String retain1 = pu.getString("top");
	String retain2 = "";
	String retain3 = "";
	String retain4 = "";
	if (action.equals("add")) {
		String create_time = new DateUtil().getCurTime();
		cmdb.insert(name, content, classid, type, state, create_time,
				ip, retain1, retain2, retain3, retain4);
		session.setAttribute("msg", "评论添加成功！");
		response.sendRedirect(referer);
		return;
	} else if (action.equals("update")) {
		cmdb.update(commentid, "name", name);
		cmdb.update(commentid, "content", content);
		cmdb.update(commentid, "classid", String.valueOf(classid));
		cmdb.update(commentid, "type", String.valueOf(type));
		cmdb.update(commentid, "state", String.valueOf(state));
		cmdb.update(commentid, "retain1", retain1);
		session.setAttribute("msg", "订单 " + commentid + " 更新成功！");
		response.sendRedirect(referer);
		return;
	} else if (action.equals("del")) {
		cmdb.delete(commentid);
		session.setAttribute("msg", "评论 " + commentid + " 删除成功！");
		response.sendRedirect(referer);
		return;
	}
%>