?? adminupfile.asp
字號:
elseif IsNumeric(thing) then
sqlStr = "select BoardID,title from JBB_Board where BoardID="&thing
rs.open sqlStr,conn,1,1
if not rs.Eof then
response.write "<a href=""../Board.asp?BoardID="&rs(0)&""" target=""_blank"">"&rs(1)&"</a>"
else
response.write "<font color=red>原版塊不存在或已刪除</font><br><a href=""?action=delSub&filePath="&thing&"&type=f"">刪除此文件夾</a>"
End if
rs.close
else
response.write "<font color=red>此目錄非本系統建立</font><br><a href=""?action=delSub&filePath="&thing&"&type=f"">刪除此文件夾</a>"
End if
response.write "</td>"
response.write"</td>"
Next
For Each thing3 in Folder.Files
response.write "<tr bgcolor=""#FFFFFF""> "
response.write "<td colspan=""4""><font color=red>UpLoad目錄同時存在以下幾個非本程序上傳的文件,建議刪除:</font><br>"
thing3 = replace(lcase(thing3),uploadPath&"\","")
response.write "<a href="""&uploadFolder&thing3&""" target=""_blank"">"&thing3&"</a> <a href=""?action=delSub&filePath="&thing3&""">刪除</a>"
response.write "</td>"
response.write "</tr>"
g=g+1
allN = allN+g
Next
AllSize = Folder.Size
AllSize=Round(AllSize/1024,2)
if AllSize < 1 and f>0 then AllSize="0"&AllSize
Set Folder = nothing
response.write "<tr bgcolor=""#EFEFE7""> "
response.write "<td colspan=""4"">共有 <font color=red>"&allN&"</font> 個文件 | 文件夾:<font color=red>"&f&"</font> | 共占用空間:<font color=red>"&AllSize&"</font>K</td>"
response.write "</tr>"
response.write "</table>"
set rs = nothing
else
response.Write("論壇根目錄下的UpLoad文件夾不存在.")
End if
End Sub
'---------------------
Sub ShowFolder()
j = 0
getFolder=trim(request.QueryString("Folder"))
noFile= "<img src=""images/Folder.gif""> <b>UpLoad\"&getFolder&"</b> 暫時沒有上傳文件。<a href=""?action=fileAll"">返回UpLoad目錄</a>"
if getFolder = "" then
response.write "參數錯誤."
Set FileObject=nothing
response.End()
end if
Folder = uploadPath&"\"&getFolder
'response.Write(Folder)
if Not(FileObject.FolderExists(Folder)) then
response.write "此目錄不存在或者已經刪除.<a href=""?action=fileAll"">返回UpLoad目錄</a>"
Set FileObject=nothing
response.End()
End if
Set Folder=FileObject.GetFolder(Folder)
For Each thing in Folder.Files
J=J+1
thing = replace(thing,Folder&"\","")
'2.3修改開始
'fileList=fileList+"<br>"&thing&" [<a href="""&uploadFolder&getFolder&"/"&thing&""" target=""_blank"">查看</a>] [<a href=""?action=delSub&filePath="& getFolder&"/"&thing &""">刪除</a>]"
fileList=fileList+"<td><input name=""filePaths"" type=""checkbox"" id=""filePaths"" value="""& getFolder&"/"&thing &""">"&thing&" [<a href="""&uploadFolder&getFolder&"/"&thing&""" target=""_blank"">查看</a>]</td>"
if J mod 2 = 0 then fileList=fileList+"</tr><tr>"
'2.3修改結束
Next
For Each thing2 in Folder.SubFolders
f=F+1
thing2 = replace(thing2,Folder&"\","")
FolderStr= FolderStr&" <a href=""?action=ShowFolder&Folder="&getFolder&"\"&thing2&""" onclick=""showDiv()""><img src=""images/Folder.gif"" border=""0""> "&thing2&"</a> <a href=""?action=delSub&filePath="&getFolder&"\"&thing2&"&type=f"">[刪除]</a><br>"
FolderNum=",<font color=red>"&f&"</font>個非本程序建立的文件夾</font>"
Next
Set Folder = nothing
if J < 0 and f<1 then
response.Write(noFile)
else
response.write "<img src=""images/Folder.gif""> <b>UpLoad\"&getFolder&"</b> 共有 <font color=red>"&j&"</font> 個附件."&FolderNum&" <a href=""?action=fileAll"">返回UpLoad目錄</a> | <a href=""javascript:history.back()"">返回上一步</a><br>"
response.write FolderStr
fileList="<table width=""95%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&chr(10)&"<form name=""delForm"" method=""post"" action=""?action=delSub""><tr>"&chr(10)&fileList
fileList=fileList+"</tr><tr><td colspan=""2""><br>"& getSetStr("delForm") &"</td></tr></form></table>"
response.Write fileList
End if
End Sub
'-----------------------------
Sub nouse()
%>
<br>
<br>
<table width="560" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#EFEFE7"><strong>檢測未被貼子引用的上傳附件:</strong></td>
</tr>
<tr>
<td height="68" valign="top" bgcolor="#FFFFFF">為保證檢測的正確性,本程序采用以文件名進入貼子表模糊搜索方式檢測,這將是非常占用系統資源和時間的(具體取決于服務器性能和貼子數量),所以<span class="style1">建議您在訪問人數較少的時候執行此操作,在同,貼子較多時各版塊分步檢測,不要同時檢測所有版塊上傳的附件!</span></td>
</tr>
<form name="form1" method="post" action="?action=search">
<tr>
<td bgcolor="#EFEFE7">選擇一個版塊:
<select name="Board" id="Board">
<%
set rs = server.CreateObject("adodb.recordset")
sql = "select JBB_Class.Class_name,JBB_Class.Class_ID,JBB_Board.BoardID,JBB_Board.title From JBB_board left join JBB_Class on (JBB_Board.ClassID = JBB_Class.Class_ID) order By JBB_Class.Class_order,JBB_Board.Boardorder asc"
rs.open sql,conn,1,1
if Not(rs.Bof and rs.Eof) then
id = 0
for board = 1 to rs.recordCount
if id <> rs("Class_id") then
response.Write"<option value=""Class_"& rtrim(rs("Class_ID")) &""">==="&rtrim(rs("Class_name"))&"===</option>"
id = rs("Class_id")
End if
response.Write"<option value="""& trim(rs("BoardID")) &"""> "&rtrim(rs("title"))&"</option>"
rs.MoveNext
Next
End if
rs.Close
set rs = Nothing
%>
</select>
<input type="submit" name="Submit2" value="檢測此版塊是否有未被引用的附件">
</td>
</tr></form>
</table>
<%
End Sub
'-------------------------
Sub search()
Board = trim(request("Board"))
if Board="" then Call nouse() end if
if not(IsNumeric(Board)) then
if left(Board,6) = "Class_" then
Board = replace(Board,"Class_","")
set rs = server.CreateObject("adodb.recordset")
rs.open "select BoardID,title From JBB_board where ClassID="&Board,conn,1,1
if Not (rs.eof and rs.bof) then
Board = ""
for b = 1 to rs.recordCount
Board = Board & rs("BoardID") &","
BoardName = BoardName & rs("title") &","
rs.MoveNext
Next
Boardlen=len(Board)
Board=left(Board,Boardlen-1)
BoardNamelen=len(BoardName)
BoardName=left(BoardName,BoardNamelen-1)
End if
rs.close
set rs = nothing
End if
else
set rs = server.CreateObject("adodb.recordset")
rs.open "select title From JBB_board where BoardID="&Board,conn,1,1
if Not (rs.eof and rs.bof) then
BoardName = rs(0)
End if
rs.close
set rs = nothing
End if
board=split(board,",")
BoardName=split(BoardName,",")
set rs = server.CreateObject("adodb.recordSet")
response.write "<form name=""delForm"" method=""post"" action=""?action=delSub"">"
for b = 0 to ubound(board)
if Not(FileObject.FolderExists(uploadPath&"\"&Board(b))) then
response.write "<b>"&boardName(b)&"</b> 暫時沒有上傳的附件<br><br>"
else
Set Folder=FileObject.GetFolder(uploadPath&"\"&Board(b))
For Each thing in Folder.Files
thing = replace(lcase(thing),uploadPath&"\"&Board(b)&"\","")
'response.write thing
sqlStr = "select postid from JBB_post where Board_ID="&Board(b)&" and postcontent like '%"& thing &"%'"
rs.open sqlStr,conn,1,1
if rs.Bof or rs.Eof then
J=J+1
fileList=fileList&"<td><input name=""filePaths"" type=""checkbox"" id=""filePaths"" value="""& Board(b)&"/"&thing &""">"&thing&"[<a href="""&uploadFolder&Board(b)&"/"&thing&""" target=""_blank"">查看</a>]</td>"
if J mod 2 = 0 then fileList=fileList+"</tr><tr>"
End if
rs.close
sqlStr = ""
Next
if j<1 then
response.write "<b>"&boardName(b)&"</b> 沒有未被引用的上傳附件<br><br>"
else
response.write "<b>"&boardName(b)&"</b> 共有 "&j&" 個附件沒被引用:<br>"
'response.write fileList&"<br><br>"
fileList="<table width=""95%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&chr(10)&"<tr>"&chr(10)&fileList
fileList=fileList+"</tr></table><br>"
response.Write fileList
End if
j=0
fileList=""
set Folder=nothing
End if
'response.write board(b)&boardName(b)&"<br>"
next'b
response.write "<table width=""95%"" border=""0"" cellspacing=""0"" cellpadding=""0""><tr><td>"& getSetStr("delForm") &"</td></tr></table></form>"
set rs = nothing
End Sub
%>
</body>
</html>
<%
set FileObject = Nothing
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -