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

📄 edit.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"-->
<%
'--------------------------------------------
    if session("adminlogin")="" then
	response.redirect("login.asp")
    end if
'--------------------------------------------
   a = GetPathWith(Cstr(request("a")))
   If Right(a,1) = "\" Then
	a = Mid(a,1,Len(a)-1)
   End If
'------------------检查权限是否正确--------------------------------
 if not session("admin") then
    '-------此处检查权限
    myPath = Split(session("dir"), "|")
    For each subDir in myPath
	If InStr(lcase(a), 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("self.close();")
	response.write("</script>")
	response.end
    end if
 end if
'----------------检测是否是有效路径
 if not CheckCorrectPath(a) then
	response.write("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
	response.write("<script language=javascript>")
	response.write("alert(""请求为非有效目录或包含非法字符!"");")
	response.write("self.close();")
	response.write("</script>")
	response.end
 end if
'------------------------------------------------------------------
   content1 = Cstr(request("content"))
   action = trim(request("type"))
'---------------
if a="" or action = "" then
	response.write("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
	response.write("<script language=""javascript"">")
	response.write("alert(""非法请求!"");")
	response.write("self.close();")
	response.write("</script>")
	response.end
end if
'---------------
   Select Case action
	case "editfile"
	  call checka()
	  action = "editfile"
	  title = "编辑文件"
	case "savefile"
	  call checka()
	  action = "savefile"
	  title = "保存文件"
	  call SaveFile(a,content1)
	case "readfile"
	  call checka()
	  action = "readfile"
	  title = "读取文件以编辑"
   End Select
%>
<html>
<head>
<title><%=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.a.value) { alert("请输入要文件路径与文件名!");return false;}
	}
//----
	function view(){
	var newWindow = window.open("about:blank",null,"")
	newWindow.document.writeln(document.savefile.content.innerText);
	}
//----	
	function order(action,name){
	obj=document.orderfile;
	obj.action="file.asp?type="+obj.select1.value;
	if(obj.a.value&&obj.b.value&&obj.a.value!=obj.b.value)
	  openWindow(obj.action+"&a="+obj.a.value+"&b="+obj.b.value);
	else
	  if(!obj.a.value){
	    alert("原『文件/目录』不可为空!"); return false;}
	  else
	    if(!obj.b.value){
	      alert("目标目录不可为空!");return false;}
	    else
	      alert("原『文件/目录』与目标目录不能相同!");
	 }
//------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 bgcolor="#FFFFFF" 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="index.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><table border="0" cellpadding="1" cellspacing="0" width="536">
        <form method="POST" action="edit.asp?type=savefile" name="savefile" onSubmit="return check(this);">
          <tr> 
            <td width="536"> 当前文件为: 
              <input type="text" name="a" value="<%=a%>" size="25"> 
              <input class="button" type="submit" value="保存\另存" name="B1"> 
              <input class="button" type="reset" value="撤销编辑" name="B3">
              <input class="button" type="button" title="只能以浏览器预览" value="预览文件" onClick="view();" name="B32"> </td>
          </tr>
          <tr>
            <td><textarea rows="28" name="content" cols="72"><% call Readfile(a)%></textarea></td>
          </tr>
        </form>
      </table></td>
    <td valign="top">
<table width="222" border="0" cellspacing="1" cellpadding="1">
        <tr>
          <td align="center" bgcolor="#CCCCCC"><font color="#990000">编辑文件操作</font></td>
  </tr>
</table>

      <table width="222" border="0" cellpadding="1" cellspacing="1">
        <form method="POST" action="edit.asp?type=readfile" name="readfile" onsubmit="return check(this)" >
          <tr> 
            <td>读取[或新建]文件并编辑:
              <input type="text" name="a" value="<%=a%>" size="23">
              <input class="button" type="submit" value="执行" name="B12"><br>
              <font color="#FF0000">注</font>:只有编辑并保存后文件才会建立!</td>
          </tr>
        </form>
      </table>
      <table width="222" border="0" cellspacing="0" cellpadding="0">
<form name="orderfile" action="">
        <tr>
          <td><table width="222" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr>
                  <td align="center" bgcolor="#CCCCCC"><font color="#990000"> 
                    其它文件操作 </font></td>
  </tr>
</table>
<table width="222" border="0" align="center" cellpadding="1" cellspacing="0">

  <tr>
                  <td> 请选择操作:<br>
                    <select class="button" name="select1" id="select1">
                      <option value="copyfile" selected>复制文件</option>
                      <option value="movefile">移动文件</option>
                      <option value="copyfolder">复制目录</option>
                      <option value="movefolder">移动目录</option>
                    </select>
                    <input name="a" type="text" id="a" size="23" value="<%=a%>">
                    <input name="b" type="text" id="b" size="23">
      <input type="button" class="button" name="Submit" onclick="order();" value="执行">
      </td>
  </tr>
</table>
</td>
        </tr></form>
      </table></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 + -