
<!-- #include file="conn.asp" -->
<!-- #include file="check.asp" -->

<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>上传图片管理 - 后台管理中心 - 126电影程序CMS</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/css_body.css" type=text/css rel=stylesheet>
<script language="javascript" src="images/admin.js"></script>
<script language="JavaScript">
function Del()
{
if(confirm("您确定要删除?\n\n DreamCtiy Theater System")
)
{return true;}
return false;}
</script>
</HEAD>
<BODY>
<DIV class=bodytitle>
<DIV class=bodytitleleft></DIV>
<DIV class=bodytitletxt>上传图片管理</DIV>
</DIV>
<%
response.Charset="GBK"
dim action
action = SafeData("RQ","action",0)

Select case action
	case "del" : del
	case else : main
End Select

sub del
dim num,MyFile,x
    Num = request.form("FileName").count
    Set MyFile=Server.CreateObject("Scripting.FileSystemObject")
    for x=1 to Num
      if MyFile.FileExists(Server.Mappath(request.form("FileName")(x))) then
          MyFile.DeleteFile(Server.Mappath(request.form("FileName")(x)))
      end if
    next
    ShowMsg "删除记录成功!" ,"admin_pic.asp"  
end sub

	sub main
	Dim rootPath : rootPath = SafeData("RQ","rootPath",0)
	%>
<table class=tbtitle style="BACKGROUND: #cad9ea;" cellSpacing="1" cellPadding="5" width="96%" align="center" border="0">
 <form action="?action=del" method="post" name="form1"> 
  <tr align="center" bgcolor="#f5fafe">
    <td><strong>文件名</strong></td>
    <td width="10%"><strong>文件大小</strong></td>
    <td width="20%"><strong>修改时间</strong></td>
    <td width="12%"><strong>操作</strong></td>
  </tr>
<%

if rootPath = "" then rootPath = "../uploadimg"
Call bianliFolder(rootPath)
%>
</form>
</table>
<%
end sub

	function bianliFolder(currentPath)
	    Dim nowpath,path,upperFolder,objFolder,objSubFolders,nextPath,fso,objSubFolder
		
		path = server.mapPath(currentPath)
		set fso = server.CreateObject("scripting.filesystemobject")    
        set objFolder=fso.GetFolder(path)
		upperFolder = LEFT(currentPath,(InStrRev(currentPath,"/")-1))
		IF upperFolder <> "../uploadimg" THEN
				Response.Write "<tr bgcolor=""#ffffff"">"
				Response.Write "<td colspan=""5""><img src=""images/dir2.gif""> <a href=""?rootPath=" &upperFolder&""">上级目录</a></td>"
				Response.Write "</tr>"
		END IF
        set objSubFolders=objFolder.Subfolders
        for each objSubFolder in objSubFolders 

            nowpath=objSubFolder.name
            nextPath = currentPath & "/" & objSubFolder.name
			Response.Write "<tr bgcolor=""#ffffff"" onmouseover=""this.bgColor='#f5fafe'"" onmouseout=""this.bgColor='#ffffff'"">"
			Response.Write "<td colspan=""5""><img src=""images/dir.gif""> <a href=""?rootPath="&nextPath&""">"&nowpath&"</a></td>"
			Response.Write "</tr>"
        next 

        
        Call bianliFile(currentPath)
        set objFolder=nothing
        set objSubFolders=nothing
        set fso = nothing
    end function
	
	function bianliFile(currentPath)
        Dim Path,fso,objFolder,nowpath,objFiles,objFile,FileExt,objSubFolders
        path = server.mapPath(currentPath)
        set fso=server.CreateObject("scripting.filesystemobject")    
       
        set objFolder=fso.GetFolder(path)
            nowpath = path
            set objFiles=objFolder.Files
			dim num,sumsize
			num = 0
			sumsize = 0
            for each objFile in objFiles
			    num = num + 1
				sumsize = sumsize + objFile.size
			    Response.Write "<tr bgcolor=""#ffffff"" onmouseover=""this.bgColor='#f5fafe'"" onmouseout=""this.bgColor='#ffffff'"">"
				Response.Write "<td><img src=""images/asp.gif""> "&objFile.name&"</td>"
				Response.Write "<td align=""center"">"&round(objFile.size/1024,3)&" KB</td>"
				Response.Write "<td align=""center"">"&objFile.DateLastModified&"</td>"
				FileExt = LCase(Mid(objFile.name, InStrRev(objFile.name, ".") + 1))
				
				Response.Write "<td align=""center""><a href="""&currentPath&"\"&objFile.name&""" target=""_blank"">浏览</a> &nbsp;"
				Response.Write "<input type=""checkbox"" id=FileName name=FileName value="""&currentPath&"/"&objFile.name&"""></td>"
				Response.Write "</tr>"
            next
		response.Write "<tr align=""center"" bgcolor=""#f5fafe"">"
		response.Write "<td colspan=""4"">"
        response.Write "<div align=""center"">本目录下共有<font color=red><b>"&num&"</b></font>个文件; "
        response.Write "占用<font color=red><b>"&sumsize&"</b></font><font color=#FF0000><b>K</b></font>"
		response.Write "空间&nbsp;&nbsp;&nbsp;&nbsp;"
        response.Write "<input type=hidden value=del Name=result>"
        response.Write "<input type=""checkbox"" name=""chkall"" onClick=""checkAll(this.checked,'input','FileName');"">"
        response.Write "选中所有 <input name=""submit"" type=submit class=input onClick=""return Del()"" value=删除></div></td></tr>"
         set objFolder=nothing
        set objSubFolders=nothing
        set fso = nothing
    end function
	
	function displayit(path)
		dim fso,ts
		set fso=server.CreateObject("scripting.filesystemobject")    
		Set ts = fso.OpenTextFile(path)
		displayit = ts.ReadAll
		ts.Close
		set fso = nothing
		set ts = nothing
    end function
	
	Function writeTextFile(fileName,fileToWrite)
	Dim fso,  fsoFile
	Set fso = CreateObject("Scripting.FileSystemObject")
	set  fsoFile  =  fso.CreateTextFile(fileName)  
	fsoFile.writeline(fileToWrite)
	fsoFile.close
	set fsoFile = nothing
	set fso = nothing
	End Function

%>
</body>
</html>
