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

<%
dim rs,sql,del_username,sql1,sql2,rs1,id,str2,i,all_id,str1,k,username,sql4,str4,a,sql3,sqllo,rslo
all_id=trim(request("selectedid"))
set rs=server.createobject("adodb.recordset")
str1=split(all_id,",")
for k=0 to ubound(str1)

sql="select id from [jle_info] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,1
do while not rs.eof
id=id +","&rs("id")&""
rs.movenext
loop
rs.close

str2=split(id,",")

     for i=1 to ubound(str2)
     
     sql="select * from [jle_info] where username='"&trim(str1(k))&"'"
rs.open sql,conn,1,1
tupian=rs("tupian")
if tupian<>"0" and  tupian<>""  then
   fileExt=lcase(right(tupian,4))
   if (fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg") and left(tupian,4)<>"http" then
   call deltu()
   end if
end if

dim xurl
xurl=server.mappath("\"&rs("xurl")& "")  
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(xurl) then
objFSO.DeleteFile(xurl)
end if
set objfso=nothing
rs.close

     sql="delete from [jle_info] where username='"&trim(str1(k))&"'"
     rs.open sql,conn,1,3
     sql1="delete from [jle_fav] where scid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
     rs.open sql1,conn,1,3
     sql2="delete from [reply] where xxid='"&cstr(str2(i))&"' or username='"&trim(str1(k))&"' "
     rs.open sql2,conn,1,3
     next
sql3="delete from [feedback] where username='"&trim(str1(k))&"' "
rs.open sql3,conn,1,3
call dello()
sql2="delete from [jle_shop] where username='"&trim(str1(k))&"' "
rs.open sql2,conn,1,3

response.write "<li>用户"&trim(str1(k))&"删除成功！"
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

sub dello()
set rslo=server.createobject("adodb.recordset")
sqllo="select * from [jle_shop] where username='"&trim(str1(k))&"'"
rslo.open sqllo,conn,1,1
dim logo,fileExt,objFSO

logo=rslo("logo")
fileExt=lcase(right(logo,4))
'if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp"  then
if fileEXT=".gif" or fileEXT=".jpg" or fileEXT=".jpeg" or fileEXT=".bmp" or fileEXT=".png" and left(logo,4)<>"http" then
'call dellogo()

dim whichfile
whichfile=server.mappath("../"& logo & "")  
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(whichfile) then
objFSO.DeleteFile(whichfile)
end if
set objfso=nothing
set rslo=nothing
end if

end sub

response.write "<script language=JavaScript>" & chr(13) & "alert('删除信息成功！')</script>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_shop_user.asp"">"
response.end
rs.close
set rs=nothing
closedb
%>