⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminupfile.asp

📁 BBS论坛的开发和设计
💻 ASP
📖 第 1 页 / 共 2 页
字号:
			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>&nbsp;&nbsp;&nbsp;<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&"&nbsp;<a href=""?action=ShowFolder&Folder="&getFolder&"\"&thing2&""" onclick=""showDiv()""><img src=""images/Folder.gif"" border=""0""> "&thing2&"</a>&nbsp;&nbsp;<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&"&nbsp;<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 + -