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

📄 index.asp

📁 BS在线文件管理系统的源码和说明
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="function.asp"-->
<!--#include file="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)
 end if
'------------------检查权限是否正确--------------------------------
 if not session("admin") then
    '-------此处检查权限
    myPath = Split(session("dir"), "|")
    For each subDir in myPath
	If InStr(1, lcase(questDir), lcase(subDir), vbTextCompare) = 1 then
	    flag = true
	end if
    Next
    If flag = false then
	response.write("<script language=javascript>")
	response.write("alert(""你没有权限访问该目录!"");")
	response.write("history.go(-1);")
	response.write("</script>")
	response.end
    end if
 end if
'----------------检测是否是有效路径
 if not CheckCorrectPath(questDir) then
	response.write("<script language=javascript>")
	response.write("alert(""请求为非有效目录或包含非法字符!"");")
	response.write("history.go(-1);")
	response.write("</script>")
	response.end
 end if
'------------------------------------------------------------------
 gFilePath=GetPathWith(questDir)
 questDir=gFilePath
'---------------------得到上级目录------------------------
 lastFolderpath=StrReverse(gFilePath)	'取路径的“反”
 path = Split(lastFolderpath, "\")	'分解
 lastFolder = path(1) & "\" 		'取最后一个目录名
 lastFolderpath = replace(lastFolderpath, lastfolder, "", 1, 1) '去掉最后一个目录
 lastFolderpath = StrReverse(lastFolderpath)'得到需要路径的“正”
'---------------------------------------------------------

%>
<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 check(thisForm){
	if (thisForm.dir.value=="<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>")
	{ alert("你已经在本目录!刷新请按右边『刷新』按钮!")
	  return false;}
	if (!thisForm.dir.value) 
	{if(confirm("你没有输入路径!将转到默认路径!是否继续?"));else return false;}
	}

	function order(action,name){
	obj=document.orderfile;
	obj.action="file.asp?type="+action;
switch (action) {
 case "editfile":
	obj.action="edit.asp?type="+action;
	obj.a.value=name;
	if(obj.a.value) obj.submit();
	break;
 case "delfile":
 case "delfolder":
	 obj.a.value=name;
	 if(obj.a.value)
	 {
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b=","","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no");
	 window.location.reload();}
	  else
	   {alert("出现错误!操作未完成!");
	    return false;
	    }
	break;
 case "renamefile":
	str=prompt('请输入新的文件名及相应路径]!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>文件名', 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)  { 
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no");
	 window.location.reload();}
	  else
	   {alert("出现错误!操作未完成!");
	    return false;
	    }
	 else alert("新文件名不能与原文件名相同!");
	  }
	  else alert("用户取消操作!");
	break;
 case "renamefolder":
str=prompt('请输入新的目录名及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>目录名',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)  { 
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no");
	 window.location.reload();}
	 else
	  {alert("出现错误!操作未完成!");
	   return false;
	   }
	 else alert("新目录名不能与原目录名相同!");
	 }
	 else alert("用户取消操作!");
	break;
 case "copyfolder":
	str=prompt('请输入目标目录名及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>目录名','<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>');
	if(str)
	{obj.a.value=name;
	 obj.b.value=str;
	 if("<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>"!=obj.b.value)
	    if(name==obj.b.value)
		alert("不能将目录拷进目录本身!");
	    else
		if(obj.a.value&&obj.b.value)  { 
	window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no");
		window.location.reload();}
		else
	  	{alert("出现错误!操作未完成!");
	   	return false;
	   	}
	 else alert("目标目录不能与原目录在同一目录下!");
	 }
	 else alert("用户取消操作!");
	break;
 case "copyfile":
	str=prompt('请输入目标目录及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>','<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>');
	if(str)
	{obj.a.value=name;
	 obj.b.value=str;
	 if(obj.b.value=="<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>") {alert("新文件不能与原文件在同一个目录下!");return;}
	 if(obj.a.value&&obj.b.value)  { 
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no");
	 window.location.reload();}
	 else
	  {alert("出现错误!操作未完成!");
	   return false;
	   }
	 }
	 else alert("用户取消操作!");
	break;
 case "movefile":
	str=prompt('请输入目标目录及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>','<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>');
	if(str)
	{obj.a.value=name;
	 obj.b.value=str;
	 if(obj.b.value=="<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>") {alert("新文件不能与原文件在同一个目录下!");return;}
	 if(obj.a.value&&obj.b.value)  {
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no"); 
	window.location.reload();}
	 else
	  {alert("出现错误!操作未完成!");
	   return false;
	   }
	 }
	 else alert("用户取消操作!");
	break;
 case "movefolder":
str=prompt('请输入目标目录及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>目录名', name);
	if(str)
	{obj.a.value=name;
	 obj.b.value=str;
	 if(obj.b.value==name) {alert("不能将目录移往目录本身!");return;}
	 if(obj.b.value=="<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>") {alert("目标目录不能与原目录在同一目录下!");return;}
	 if(obj.a.value&&obj.b.value)  { 
	 window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no"); 
	window.location.reload();}
	 else
	  {alert("出现错误!操作未完成!");
	   return false;
	   }
	 }
	 else alert("用户取消操作!");
	break;
	
	default: ;
	if(action=="mdfile")
	str=prompt('请输入文件名及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>filename.txt','<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>');
	else str=prompt('请输入目录名及相应路径!如:<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>目录名','<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>');
	if(str)
	{obj.a.value=str;
	 if(obj.a.value) {
	if(obj.a.value=="<%= replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>") {alert("错误!可能原因:\n1.目标『文件/目录』已经存在!\n2.没有输入『文件/目录』名!");return;}
	window.showModalDialog(obj.action+"&a="+obj.a.value+"&b="+obj.b.value,"","dialogWidth:280px;dialogHeight:150px;scroll:no;status:no;help:no"); 	
	window.location.reload();}
	 else
	  {alert("出现错误!操作未完成!");
	   return false;
	   }
	 }
	 else alert("用户取消操作!");
	}}
	function refresh() {
	flag=confirm("确定要刷新请按『确定』按钮!");
	if(!flag) return;
	obj=document.go;
	obj.dir.value="<%=replace(replace(replace(gFilePath,"\","\\"),"'","\'"),"""","\""")%>";
	obj.submit();
	}
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
	}
//-->
</script>
</head>
<body leftmargin="0">
<table width="758" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td style="border: 1 solid #000000" width="57" align="center"><a href="logout.asp?logout=1">退出管理</a></td>
    <td  width="28" align="center">&nbsp;</td>
    <td  width="57" align="center" style="border: 1 solid #000000"><a href="login.asp">资料管理</a></td>
    <td align="center"><b><font size="4">[<%=name%>]</font></b><font color="#ccaacc">-version:<%=version%></font>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  </tr>
</table>
<hr align="center"  width="758" size="1" noshade color="#ccaacc" height="1">

<table width="758" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><%call ShowDriveList()%></td>
  </tr>
</table>
<table width="758" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><hr align="center"  width="758" size="1" noshade color="#ccaacc" height="1"></td>
  </tr>
</table>

<table width="758" border="0" align="center" cellpadding="1" cellspacing="0">
<form action="index.asp" method="post" name="go" onSubmit="return check(this)">
  <tr> 
      <td width="415" height="25"> 当前目录为 <font color="#FF0000"><%=gFilePath%></font></td>
      <td width="343" 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="<%=gfilepath%>">
        <input class="button" type="submit" name="Submit" value="跳转">
	<input class="button" type="button" value="刷新" onClick="javascript:refresh();">
      </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">
  <form action="" method="post" target="_blank" name="orderfile">
    <tr> 
      <td width="377" height="20">目录列表:[<a href="
<%
if trim(gfilepath) <> trim(lastFolderpath) then
response.write("index.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>] 
        <input name="b" type="hidden" id="b">
              [<a href="upload.asp?dir=<%=gfilepath%>" target="_blank">文件上传</a>]</td>
    </tr>
    <tr> 
      <td width="377" valign="top"> 
        <% call showFolderList(gFilePath)%>
      </td>
      <td width="377" valign="top"> 
        <% call showFileList(gFilePath)%>
      </td>
    </tr>
  </form>
</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 + -