<!--#include file="include/ht.asp"-->
<%
acdb="xld_news"
tp=request.querystring("type")
action=request.querystring("action")
set rs=server.createobject("adodb.recordset")
on error resume next
sql="select * from "&acdb&""

if action="add" then
rs.open sql,conn,3,3
rs.addnew

rs("news_title")=request.form("title")
rs("news_content")=request.form("content")
rs("news_author")=request.form("author")
rs("news_from")=request.form("from")
rs("news_sp")=request.form("sp")
rs("news_type")=tp

rs.update
session("msg")="添加成功"
response.redirect("news_admin.asp?type="&tp&"")
else
id=request.querystring("id")

if action="modify"then
sql_update="select * from "&acdb&" where news_id="&id&""
rs.open sql_update,conn,3,3

rs("news_title")=request.form("title")
rs("news_content")=request.form("content")
rs("news_author")=request.form("author")
rs("news_from")=request.form("from")
rs("news_type")=request.form("tp")
rs("news_sp")=request.form("sp")
rs.update
session("msg")="修改成功"

response.redirect("news_admin.asp?type="&tp&"")

elseif action="del" then


For Each x In Request.Form

if x="Submit2" then
else
id=trim(request.form(x))
'response.write id
if id=""  then
session("msg")="请选择你要删除的内容"
response.redirect("news_admin.asp?type="&tp&"")
else
conn.execute("delete from "&acdb&" where news_id="&id&"")
end if
end if  'ID为空的情况

next
session("msg")="删除成功"
response.redirect("news_admin.asp?type="&tp&"")

end if
end if
%>

<%
dl=left(trim(request.form("dl")),50)
action=request.querystring("action")
if action="cl_add" then
							if 	dl="" then
							session("msg")="请输入大类名称"
							response.redirect("dl_admin.asp")
							end if

				sql="insert into xld_news_lb(lb_mc) values('"&dl&"')"
				conn.execute(sql)
				session("msg")="添加成功"
				response.redirect("news_lb_admin.asp")

elseif action="cl_modify" then
				  id=request.querystring("id")
				           
				  sql="update xld_news_lb set lb_mc='"&dl&"' where lb_id="&id&""
				  conn.execute(sql)
				  session("msg")="修改成功"
				  response.redirect("news_lb_admin.asp")
						

elseif action="cl_del" then
				id=request.querystring("id")
				sql="delete from xld_news_lb where lb_id="&id&""
				conn.execute(sql)
				session("msg")="删除成功"
				response.redirect("news_lb_admin.asp")
end if
%>