www.gusucode.com > 深度梦想整站系统(asp) 1.14.02源码程序 > admin/photo/photo_DEL.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
projectRootPath = "../../"	'相对当前应用程序根的位置
%>
<!-- #include file="../web.config.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="robots" content="noindex,nofollow" />
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>管理</title>
    
	    <link href="../themes/<%=theme_Path%>/main.css" rel="stylesheet" type="text/css" />
</head>

<body  id="bodyBg1">
<br />
&nbsp; <a href="photo_Manage.asp">图片管理</a> | <a href="photo_Add.asp">添加图片</a>
<hr class="Nav-hr" />
<br />

<dl class="manageContent">
    <dt>图片管理</dt>
    <dd>
    	<br />

<%
selectDelID=Request.Form("selectDel")

if selectDelID <> "" then

	aryID=split(selectDelID,",")
	for each id in aryID
	
	Set rsSoft=Server.CreateObject("Adodb.Recordset")
	SqlDEL="Select * from deep_Photo where fid=" & id
	rsSoft.open SqlDEL,conn,3,2
	

	If not IsObjInstalled("Scripting.FileSystemObject") Then
		Response.Write "<b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能删除关联图片</font></b>"
	else

		'图片地址
		if rsSoft("fuploadFiles")<>"" then
				' 把带"|"的字符串转为数组,用于初始下拉框表单
				'Dim aSavePicPathFileName
				aSavePicPathFileName = Split(rsSoft("fuploadFiles"), "|")
				For i = 0 To UBound(aSavePicPathFileName)
					Call DoDelFile( projectRootPath&aSavePicPathFileName(i) )
				Next
		end if


		if rsSoft("PhotoUrl")<>"" then
				' 把带"|"的字符串转为数组,用于初始下拉框表单
				'Dim aSavePicPathFileName
				aSavePicPathFileName = Split(rsSoft("PhotoUrl"), "|")
				For i = 0 To UBound(aSavePicPathFileName)
					Call DoDelFile( projectRootPath&"photo/uploadFile/photoPic/"&aSavePicPathFileName(i) )
				Next
		end if

	end if
	
	rsSoft.delete
	rsSoft.update
		
	rsSoft.close
	Set rsSoft=Nothing
	'Call CloseConnDB()
	Response.Write("图片("&id&")成功删除!!!<br />")
	next
else
	Response.Write("<p align='center'>图片未删除!!!</p>")
end if

' 删除指定的文件
Sub DoDelFile(sPathFile)
	On Error Resume Next
	Dim oFSO
	Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
	oFSO.DeleteFile(Server.MapPath(sPathFile))
	Set oFSO = Nothing
End Sub

'**************************************************
'函数名:IsObjInstalled
'作  用:检查组件是否已经安装
'参  数:strClassString ----组件名
'返回值:True  ----已经安装
'       False ----没有安装
'**************************************************
Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Set xTestObj = Server.CreateObject(strClassString)
	If 0 = Err Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function

%>
        <br />
        <br />
    </dd>
</dl>
<br />

</body>
</html>
<%
call closeConnDB()
%>