<%dbdns="../../"%>
<!--#include file="../../inc/conn.asp"-->
<!--#include file="../cook.asp"-->
<%if fla0<>1 then
response.write "<script>alert('操作权限出错，您没有权限操作些功能');history.go(-1);</Script>"
Response.End 
end if%>
<%
if request("action")="del" then
set Fs = Server.CreateObject("Scripting.FileSystemObject")
set rs = Server.CreateObject("ADODB.Recordset")
set rs1 = Server.CreateObject("ADODB.Recordset")
sql="select * from dlxf_yp where dlxf_ypxxtwo_id=" & request("ypxxtwo_id")
rs.open sql,conn,1,1
do while not rs.eof

userfolder="../../UserDocument/"&rs("dlxf_user")
If Fs.folderExists(server.mappath(userfolder)) Then
Fs.DeleteFolder(server.mappath(userfolder))
end if

sql1="select * from dlxf_news where dlxf_yp_id="&id(i)
rs1.open sql1,conn,1,1
filename="../../html/news/"&year(rs1("dlxf_date"))&month(rs1("dlxf_date"))&"/"&replace(replace(replace(rs1("dlxf_date"),"-",""),":","")," ","")&".html"
rs1.close
If Fs.FileExists(server.mappath(filename)) Then
set Os = Fs.GetFile(server.mappath(filename))
Os.Delete
end if
conn.execute("delete from dlxf_news where dlxf_yp_id=" & rs("dlxf_id"))

sql1="select * from dlxf_xxnews where dlxf_yp_id="&id(i)
rs1.open sql1,conn,1,1
filename="../../html/xxnews/"&year(rs1("dlxf_date"))&month(rs1("dlxf_date"))&"/"&replace(replace(replace(rs1("dlxf_date"),"-",""),":","")," ","")&".html"
rs1.close
If Fs.FileExists(server.mappath(filename)) Then
set Os = Fs.GetFile(server.mappath(filename))
Os.Delete
end if
conn.execute("delete from dlxf_xxnews where dlxf_yp_id=" & rs("dlxf_id"))

conn.execute("delete from dlxf_cp where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_cp_sort where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_Job_zp where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_sca where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_yp where dlxf_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_upfile where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_leaveword where dlxf_book_ypid=" & rs("dlxf_id"))
conn.execute("delete from dlxf_message where dlxf_yp_id=" & rs("dlxf_id") & " or dlxf_send_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_collection where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_collection_sort where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_friend where dlxf_yp_id=" & rs("dlxf_id"))
conn.execute("delete from dlxf_exhibit where dlxf_yp_id=" & rs("dlxf_id"))
rs.movenext
loop
rs.close
set rs1=nothing
set rs=nothing
set fs=nothing

conn.execute("delete from dlxf_cp where dlxf_ypxxtwo_id=" & request("ypxxtwo_id"))
conn.execute("delete from dlxf_yp where dlxf_ypxxtwo_id=" & request("ypxxtwo_id"))
conn.execute("delete from dlxf_sca where dlxf_ypxxtwo_id=" & request("ypxxtwo_id"))
conn.execute("delete from dlxf_exhibit where dlxf_ypxxtwo_id=" & request("ypxxtwo_id"))

conn.execute("delete from dlxf_ypxxtwo where dlxf_ypxxtwo_id=" & request("ypxxtwo_id"))

Response.Redirect "addoneadd.asp"
end if

dim ypxxtwo
ypxxtwo=request("ypxxtwo")
pic=request("pic")
if pic="" then pic=null
if ypxxtwo="" then
	response.write "<script>alert('对不起，小类栏目不能为空！');history.go(-1);</Script>"
	Response.End 
end if

if request("action")="add" then
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from dlxf_ypxxtwo" 
rs.open sql,conn,1,3

rs.AddNew
rs("dlxf_ypxxtwo")=ypxxtwo
rs("dlxf_ypxxone")=request("ypxxone")
rs("dlxf_ypxxone_id")=request("ypxxone_id")
rs("dlxf_pic")=pic
rs.Update
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "addoneadd.asp?id="&request("ypxxone_id")&"&one="&request("ypxxone")
end if

if request("action")="edit" then
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from dlxf_ypxxtwo where dlxf_ypxxtwo_id="&request("ypxxtwo_id")
rs.open sql,conn,1,3
rs("dlxf_ypxxtwo")=ypxxtwo
rs("dlxf_pic")=pic
rs.Update
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "addoneadd.asp"
end if
%>
