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

📄 main.asp

📁 BS在线文件管理系统,采用asp编程,实现了对文件的简单管理,并且有比较方便的各种功能的实现.-BS online document management system, using asp prog
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/function.asp"-->
<!--#include file="inc/driver.asp"-->
<%
    session("goindex") = false
'--------------------------------------------
    if session("adminlogin") = "" or session("dir") = "" then
	response.redirect("login.asp")
    end if
'--------------------------------------------
on error resume next
'----------------过滤字符
 questDir=GetPathWith(request("dir"))
'----------------设置默认目录
 if questDir = "" then
	myPath = Split(session("dir"), "|")
	questDir = myPath(0)
	if right(questDir,1) <> "\" then questDir = questDir & "\"
 else
	if right(questDir,1) <> "\" then questDir = questDir & "\"
 end if
'------------------检查权限是否正确--------------------------------
 if not session("admin") then
    '-------此处检查权限
    myPath = Split(session("dir"), "|")
    For each subDir in myPath
	If InStr(questDir, lcase(subDir)) > 0 then
	    flag = true
	end if
    Next
    If flag = false then
	response.write("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
	response.write("<script language=javascript>")
	response.write("alert(""你没有权限访问该目录!"");")
	response.write("history.back();")
	response.write("</script>")
	response.end
    end if
 end if
'----------------检测是否是有效路径
 if not CheckCorrectPath(questDir) then
	response.write("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
	response.write("<script language=javascript>")
	response.write("alert(""请求为非有效目录或包含非法字符!"");")
	response.write("history.back();")
	response.write("</script>")
	response.end
 end if
'---------------------得到上级目录------------------------
 curFolderPath = Left(questDir,Len(questDir)-1)
 lastFolderpath = Left(questDir,InStrRev(curFolderPath,"\"))
'---------------------------------------------------------
%>
<html>

<head>
<title><%=name%>--[By BrightStar]</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Meta Name="description" Content="BS在线文件管理系统">
<Meta Name="Keywords" Content="BS在线文件管理系统">
<meta http-equiv="pragma" content="no-cache">
<link href="styles.css" rel="stylesheet" type="text/css">
<script language = "Javascript">
<!--
	function checkit(it)
	{
	 if(it=="folder") obj=document.folder; else obj=document.file;
	 act=obj.checkall.checked;
	 for(i=1;i<=obj.b.value;i++)
	  obj.elements[i].checked=act;
	}
//------End Function
	function check(thisForm){
	if (!thisForm.dir.value){
	  if(confirm("你没有输入路径!将转到默认路径!是否继续?"));
	else
	  return false;}
	}
//------End Function
	function order(action,name){
	obj=document.orderfile;
	obj.action="file.asp?type="+action;
 switch (action) {
 case "editfile":
	obj.action="edit.asp?type="+action;
	obj.target="_blank";
	obj.a.value=name;
	if(obj.a.value)
	  obj.submit();
	break;
 case "delfile":
	obj2=document.file;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(obj.a.value){
	  if(confirm('你确定要删除所选文件吗?\t'))
	  openWindow('file.asp?type='+action+'&a='+obj.a.value);}
	else
	  alert("请选择你要删除的文件!");
	break;
 case "delfolder":
	obj2=document.folder;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(obj.a.value){
	  if(confirm('你确定要删除所选目录吗?\t'))
	  openWindow('file.asp?type='+action+'&a='+obj.a.value);}
	else
	  alert("请选择你要删除的目录!");
	break;
 case "renamefile":
	str=prompt('请输入新的文件名及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>文件名', name);
	obj.a.value=name;
	if(str){
	  obj.b.value=str;
	  if(obj.a.value!=obj.b.value){
	    if(obj.a.value&&obj.b.value)
	      openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);}
	  else
	    alert("新文件名不能与原文件名相同!");}
	break;
 case "renamefolder":
	str=prompt('请输入新的目录名及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>目录名',name);
	if(str){
	obj.a.value=name;
	obj.b.value=str;
	if(obj.a.value!=obj.b.value){
	  if(obj.a.value&&obj.b.value)
	  openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);}
	else
	  alert("新目录名不能与原目录名相同!");}
	break;
 case "copyfolder":
	obj2=document.folder;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(!obj.a.value) {alert("请选择你要复制的目录!");return;}
	str=prompt('请输入目标目录名及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>目录名','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	if(str){
	obj.b.value=str;
	if("<%=replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>"!=obj.b.value)
	    if(name==obj.b.value)
		alert("不能将目录拷进目录本身!");
	    else
		openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);
	else
	  alert("目标目录不能与原目录在同一目录下!");}
	break;
 case "copyfile":
	obj2=document.file;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(!obj.a.value) {alert("请选择你要复制的文件!");return;}
	str=prompt('请输入目标目录及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	if(str){
	obj.b.value=str;
	if(obj.b.value=="<%=replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>") 
	  {alert("新文件不能与原文件在同一个目录下!");return;}
	if(obj.a.value&&obj.b.value)  {
	  openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);}
	}
	break;
 case "movefile":
	obj2=document.file;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(!obj.a.value) {alert("请选择你要移动的文件!");return;}
	str=prompt('请输入目标目录及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	if(str){
	obj.b.value=str;
	if(obj.b.value=="<%=replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>")
	  {alert("新文件不能与原文件在同一个目录下!");return;}
	if(obj.a.value&&obj.b.value) {
	  openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);}
	}
	break;
 case "movefolder":
	obj2=document.folder;
	for(i=1;i<=obj2.b.value;i++)
	 if(obj2.elements[i].checked) 
	    if(!name) name=obj2.elements[i].value; else name=obj2.elements[i].value+"|"+name;
	obj.a.value=name;
	if(!obj.a.value) {alert("请选择你要移动的目录!");return;}
	str=prompt('请输入目标目录名及相应路径!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>目录名','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	if(str){
	obj.b.value=str;
	if("<%=replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>"!=obj.b.value)
	    if(name==obj.b.value)
		alert("不能将目录移进目录本身!");
	    else
		openWindow('file.asp?type='+action+'&a='+obj.a.value+'&b='+obj.b.value);
	else
	  alert("目标目录不能与原目录在同一目录下!");}
	break;
	
	default:
	if(action=="mdfile")
	str=prompt('请输入文件名及相应路径[如有多个,请以“|”隔开]!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>filename.txt','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	else str=prompt('请输入目录名及相应路径[如有多个,请以“|”隔开]!\n如:<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>目录名','<%= replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>');
	if(str){
	obj.a.value=str;
	if(obj.a.value) {
	if(obj.a.value=="<%=replace(replace(replace(questDir,"\","\\"),"'","\'"),"""","\""")%>") 
	  {alert("请输入新建『目录』或『文件』名!");
	  return;}
	  openWindow('file.asp?type='+action+'&a='+obj.a.value);}
	}
	}//End Switch
	}//End Function
//------End Function

	function openWindow(theURL) { //v2.0
	window.open(theURL,'','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=280,height=150');
	}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<table width="758" border="0" align="center" cellpadding="1" cellspacing="0">
<form action="main.asp" method="post" name="go" onSubmit="return check(this)">
  <tr> 
      <td width="413" height="25"> 当前目录: <font color="#FF0000"><%=questDir%></font></td>
      <td width="345" align="right">
	<input onclick="history.go(1)" class="button" type="button" value="前进">
	<input onclick="history.go(-1)" class="button" type="button" value="后退">
        <input name="dir" type="text" id="dir" value="<%=questDir%>">
        <input class="button" type="submit" name="Submit" value="跳转">
      </td>
  </tr>
 </form>
  <tr><td  colspan="2">
<table height="1" width="758" border="0" align="center" cellpadding="1" cellspacing="0">
<tr><td bgcolor="#ccaacc"></td></tr></table>

<% if session("dir") <> "" or session("admin") then %>

<table height="280" width="758" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr>
     <form action="file.asp" method="post" name="orderfile" target="_self"> 
      <td width="377" height="20">[<a href="
<%
if trim(questDir) <> trim(lastFolderpath) then
response.write("main.asp?dir=" & lastFolderpath)
else
response.write("javascript:;"" onClick=""javascript:alert('不可实现!现在已经位于根目录下!');")
end if
%>">回上级目录</a>][<a href="javascript:;" onClick="javascript:order('mdfolder','');">新建目录</a>] 
        <input name="a" type="hidden" id="a"></td>
      <td width="377" height="20">[<a href="javascript:;" onClick="javascript:order('mdfile','');">新建文件</a>][<a href="upload.asp?dir=<%=questDir%>" target="_blank">文件上传</a>]
        <input name="b" type="hidden" id="b"></td>
     </form>
    </tr>
    <tr> 
      <td width="377" valign="top"> 
        <% call showFolderList(questDir)%>
      </td>
      <td width="377" valign="top"> 
        <% call showFileList(questDir)%>
      </td>
    </tr>
</table>
<%
 end if
 %>
</td></tr>
</table>

<hr align="center" width="758" size="1" noshade color="#ccaacc" height="1">
<center><%=copyright%></center>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -