www.gusucode.com > 盐城分类信息网asp源码程序 > admin/xinxi_del.asp
<!--#include file=conn.asp--> <!--#include file=cookies.asp--> <% dim rs,sql,id,i,str2,username,tupian,objFSO,fileExt,sql1,rs1,sql2 username=request.cookies("cnmai")("username") id=trim(request("selectedid")) if trim(id)="" then response.write "<script language=JavaScript>" & chr(13) & "alert('没有选择记录!');" & "history.back()" & "</script>" response.end end if str2=split(id,",") set rs=server.createobject("adodb.recordset") for i=0 to ubound(str2) sql="select * from [xinxi] where id="&cstr(str2(i)) rs.open sql,conn,1,1 'On Error Resume Next if rs("tupian")="0" or rs("tupian")="" then else tupian=rs("tupian") fileExt=lcase(right(tupian,4)) if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" then 'if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(tupian,4)<>"http" then call deltu() end if end if rs.close sql="delete from [xinxi] where id="&cstr(str2(i)) rs.open sql,conn,1,3 sql1="delete from [shoucang] where scid='"&cstr(str2(i))&"' " rs.open sql1,conn,1,3 sql2="delete from [hf] where xxid='"&cstr(str2(i))&"' " rs.open sql2,conn,1,3 next sub deltu() dim whichfile whichfile=server.mappath("../"& tupian & "") Set objFSO = Server.CreateObject("Scripting.FileSystemObject") if objFSO.fileExists(whichfile) then objFSO.DeleteFile(whichfile) end if set objfso=nothing end sub response.write "<script language=JavaScript>" & chr(13) & "alert('删除信息成功!')</script>" response.write "<meta http-equiv=refresh content=""1;URL=xinxi.asp"">" response.end rs.close set rs=nothing closedb %>