path="../uploadimage/"
set fso=server.createobject("Scripting.FileSystemObject")
strsql="select filename from photo where id=num1 or id=num2
rs.open strsql,conn,1,1
if not rs.eof and not rs.bof then
do while not rs.eof
file=rs("filename")
fso.deletefile Server.MapPath(path&file),true
loop
set fso=nothing
id=Request("num")
if id <>"" then
dim sql
sql="DELETE FROM photo WHERE num IN "
sql=sql &"(" & id & ")"
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_conn_STRING
Command1.CommandText = sql
Command1.Execute()
sub delPic(picPath,picName)
if picPath<>"" then
picPath=server.MapPath(picPath)
else
exit sub
end if
SET fs=server.CreateObject("Scripting.FileSystemObject")
if FS.FileExists(picPath & "/" & picName) then
FS.DeleteFile picPath & "/" & picName,true
end if
set fs=nothing
end sub
Sub CleanUpGIF(GIFpath)
Dim objFS
Dim objFolder
Dim gif
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFolder = objFS.GetFolder(GIFpath)
for each gif in objFolder.Files
if instr(gif.Name, ".gif") > 0 and DateDiff("n", gif.DateLastModified, now) > 10 then
objFS.DeleteFile GIFpath & "\" & gif.Name, True
end if
next
set objFolder = nothing
set objFS = nothing
End Sub
<!--#include file="../qq.asp" -->
<%
dim id
dim file
file=request("url")
path="../uploadimage/"
set fso=server.createobject("Scripting.FileSystemObject")
fso.deletefile Server.MapPath(path&file),true
set fso=nothing
id=Request("num")
if id <>"" then
dim sql
sql="DELETE FROM photo WHERE num IN "
sql=sql &"(" & id & ")"
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_conn_STRING
Command1.CommandText = sql
Command1.Execute()
%>
<script>
alert("删除成功!")
location.href="del_photo1.asp"
</script>
<% end if %>
<% response.write "<script> alert('对不起,您没选择');history.back(1);</script>"
%>