<% dim cls if session("admin")="" then Response.Redirect("index.asp?err=4") else if session("flag")<>"0" then cls = Instr(session("flag"), "tem") if cls <= 0 then %> <% end if end if end if %> 管理中心——>系统管理
当前位置:网站管理中心--系统管理
上 传 文 件 管 理 产品列表  详细资料  新闻动态  下载系统  数据库备份   
   
<% '*********************************************** '函数名:JoinChar '作 用:向地址中加入 ? 或 & '参 数:strUrl ----网址 '返回值:加了 ? 或 & 的网址 '*********************************************** function JoinChar(strUrl) if strUrl="" then JoinChar="" exit function end if if InStr(strUrl,"?")1 then if InStr(strUrl,"&")"" then currentPage=cint(request("page")) else currentPage=1 end if if right(SaveUpFilesPath,1)<>"/" then UploadDir="../" & SaveUpFilesPath & "/" else UploadDir="../" & SaveUpFilesPath end if truePath=Server.MapPath(UploadDir) If not IsObjInstalled("Scripting.FileSystemObject") Then Response.Write "


你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能
" Else set fso=CreateObject("Scripting.FileSystemObject") if request("Action")="Del" then whichfile=server.mappath(Request("FileName")) Set thisfile = fso.GetFile(whichfile) thisfile.Delete true Response.Redirect "Admin_img.asp?page="&Request("page")&"" elseif request("Action")="DelAll" then if request("ok")="删除无效图片" then on error resume next id=split(request("delallid"),",") for i=0 to ubound(id) fso.DeleteFile server.MapPath(id(i)),true next Response.Redirect "Admin_img.asp?page="&Request("page")&"" else delid=replace(request("id")," ","") if delid="" or isnull(delid) then Response.write "


操作失败,没有选择合适参数!点击返回

" Response.end else on error resume next id=split(delid,",") for i=0 to ubound(id) fso.DeleteFile server.MapPath(id(i)),true next Response.Redirect "Admin_img.asp?page="&Request("page")&"" end if end if end if %>

<% if fso.FolderExists(truePath)then FileCount=0 TotleSize=0 Set theFolder=fso.GetFolder(truePath) For Each theFile In theFolder.Files FileCount=FileCount+1 TotleSize=TotleSize+theFile.Size next totalPut=FileCount if currentpage<1 then currentpage=1 end if if (currentpage-1)*MaxPerPage>totalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if if currentPage=1 then showpage2 strFileName,totalput,MaxPerPage showContent showpage2 strFileName,totalput,MaxPerPage response.write "

本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K
" else if (currentPage-1)*MaxPerPage
本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K
" else currentPage=1 showpage2 strFileName,totalput,MaxPerPage showContent showpage2 strFileName,totalput,MaxPerPage response.write "
本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K
" end if end if else response.write "找不到文件夹!可能是配置有误!" end if end if sub showContent() dim c FileCount=0 TotleSize=0 %>

<% dim delallid delallid="" For Each theFile In theFolder.Files c=c+1 if FileCount>=MaxPerPage then exit for elseif c>MaxPerPage*(CurrentPage-1) then %> <% FileCount=FileCount+1 TotleSize=TotleSize+theFile.Size end if Next %>
文件名 文件大小 文件类型 最后修改时间 产品名称 操作
 <%=theFile.Name%> <%if theFile.size>1024 then%> <%=theFile.size\1024%>K <%else%> <%=theFile.size%>字节 <% end if %> <%=theFile.type%> <%=theFile.DateLastModified%> <% prod=theFile.Name set rs2=server.createobject("adodb.recordset") sql="select * from ProdMain where ImgPrev like '%"&prod&"%'" rs2.Open sql,conn,1,1 if rs2.bof and rs2.eof then response.write "无效图片" if delallid="" then delallid=UploadDir&theFile.Name else delallid=delallid&","&UploadDir&theFile.Name end if else response.write rs2("ProdId") rs2.close set rs2=nothing end if %> 删除
 全选      
<% end sub %>
<% sub showpage2(sfilename,totalnumber,maxperpage) dim n, i,strTemp if totalnumber mod maxperpage=0 then n= totalnumber \ maxperpage else n= totalnumber \ maxperpage+1 end if strTemp= "
" strTemp=strTemp & "共 " & totalnumber & " 个文件,占用 " & TotleSize\1024 & " K   " sfilename=JoinChar(sfilename) if CurrentPage<2 then strTemp=strTemp & "首页 上一页 " else strTemp=strTemp & "首页 " strTemp=strTemp & "上一页 " end if if n-currentpage<1 then strTemp=strTemp & "下一页 尾页" else strTemp=strTemp & "下一页 " strTemp=strTemp & "尾页" end if strTemp=strTemp & " 页次:" & CurrentPage & "/" & n & "页 " strTemp=strTemp & " " & maxperpage & "" & "个文件/页" strTemp=strTemp & " 转到:" strTemp=strTemp & "
" response.write strTemp end sub %>