<% timeout(1) set con = server.createobject("ADODB.Connection") con.open Application("CString") ptype = request("ptype") newsID = request("newsID") if request("id") <> empty then strSQL = "SELECT Directory_File FROM Page_Images WHERE PageType = "& ptype &" AND Directory_File = '"& Replace(request("id"), "'", "''") &"' AND NewsID = " & newsID set rsCheckOtherUse = con.execute(strSQL) if rsCheckOtherUse.EOF then strPathFile = server.mappath("..\..\Page_Images\"& request("id")) DeleteFile(strPathFile) arrFile = split(request("id"), "\") strTempDir = "" strThisFile = "" for i = 0 to UBound(arrFile) If i = UBound(arrFile) then strThisFile = arrFile(i) else strTempDir = strTempDir & arrFile(i) &"\" end if Next strPathFile = server.mappath("..\..\Page_Images\Thumbs\"& strThisFile) DeleteFile(strPathFile) strPathFile = server.mappath("..\..\Page_Images\Thumbs\vs_"& strThisFile) DeleteFile(strPathFile) strPathFile = server.mappath("..\..\Page_Images\Big\"& strThisFile) DeleteFile(strPathFile) Session("GalleryUpdate") = "TRUE" Session("ServerName") = LCase(request.servervariables("HTTP_HOST")) end if end if strSQL = "DELETE FROM Page_Images WHERE PageType = "& ptype &" AND Directory_File = '"& Replace(request("id"), "'", "''") &"' AND PageType = "& request("ptype") &" AND NewsID = " & NewsID con.execute(strSQL) response.redirect("photos_news.asp?ptype="& ptype &"&newsID="& NewsID &"&pageID="& request("pageID") &"&dir="& server.URLEncode(request("dir")) &"&intPage="& request("intPage") &"&buster="& server.URLEncode(now)) %>