<!-- #include file="conn.asp"-->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>后台操作</title>
</head>

<body>
<%
sub add  '添加类别
  id=request("classId")
  classname=request("classname")
  set rs=server.createobject("adodb.recordset")
      rs.open "select * from FAQ_class where classid="&id,conn,1,1
		if id=0 then
	  		parentid=0
			classdepth=0
		else
     		parentid=rs("classID")
			classdepth=rs("classDepth")+1
	  end if
      
      rs.close
      set rs=nothing
  sql="INSERT INTO FAQ_class (classname,parentid,classdepth) values ('"&classname&"',"&id&","&classdepth&")"
  conn.execute sql
  response.Write"<script>alert('添加成功!');location.href='class.asp';</script>"
end sub
  
sub modify  '修改类别
	classId=request("classId")
	classname=request("classname")
	classdepth=request("classdepth")'深度以后扩展
  sql="update FAQ_class set classname='"&classname&"' where classid="&classId
  conn.execute sql
  response.Write"<script>alert('修改成功!');</script>"
end sub
sub del  '删除类别
  sql="delete from FAQ_class where classID="&request("classID")
  conn.execute sql
  response.Write"<script>alert('删除成功!');</script>"
end sub
%>

<%
if request("exe")="add" then	call add
if request("exe")="modify" then	call modify
if request("exe")="del" then	call del
if request("name")<>"" then
%>

<%end if%>
</body>
</html>



