
<!-- #include file="../conn.asp" -->
<!-- #include file="admin.asp" -->
<%Call Head()
call saycarda("文件分类删除")
%>

<%
    dim rs,sql,lid
    lid=request.querystring("lid")
    set rs=server.CreateObject ("ADODB.Recordset") 
sql="Select * from xzlist where lid="&lid
rs.open sql,conn,2,3  
if not (rs.bof and rs.eof) then
rs.delete  
rs.close
set rs=nothing
   set rs=server.CreateObject ("ADODB.Recordset") 
rs.open "Select * from xzfile where lid="&lid ,conn,2,3  
If Not rs.eof Then
Do until RS.Eof
if rs("url")<>"" then
Set fso = server.CreateObject("Scripting.FileSystemObject")
	IF (fso.FileExists(Server.MapPath(replace(rs("url"),"http://"&request.ServerVariables("Server_NAME")&"","")))) Then
	Set delfile = fso.GetFile(Server.MapPath(replace(rs("url"),"http://"&request.ServerVariables("Server_NAME")&"","")))
	delfile.Delete
	set delfile=nothing
	end if
set fso=nothing
	end if
if rs("pic")<>"" then
Set fso = server.CreateObject("Scripting.FileSystemObject")
	IF (fso.FileExists(Server.MapPath(replace(rs("pic"),"http://"&request.ServerVariables("Server_NAME")&"","")))) Then
	Set delfile = fso.GetFile(Server.MapPath(replace(rs("pic"),"http://"&request.ServerVariables("Server_NAME")&"","")))
	delfile.Delete
	set delfile=nothing
	end if
set fso=nothing
	end if

rs.delete
rs.update  
rs.movenext
loop
end if
rs.close
set rs=nothing
Response.Write "文件类别(包含类别中的文件)删除成功!"     
else
Response.Write "文件类别删除失败!类别不存在或者已删除!"  
%>
<%end if%>
<br/>----------<br/>
<a href='wjclass.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>'>[文件大类]</a><br/>
<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a>
<%call headsay()%>
