crfor.asp

来自「一套比较完整的内部技术支持全部源代码,请大家共同分享」· ASP 代码 · 共 60 行

ASP
60
字号
<%@ Language=VBScript %>
<%if Session("yyj_name")="" or Session("currentpath")="" then  '身份验证!
	Response.Redirect "error.asp?id=7"
	Response.End
  end if
  if Request.ServerVariables("REQUEST_METHOD")="POST" then  '是否为提交表单!
	url=session("currentpath")&"\"&session("zipath")
	foldername=Request.Form("newpath")
	if foldername="" or checkname(foldername)=false then        '检查文件名是否合法!
		Response.Redirect "error.asp?id=7"
		Response.End
	end if
	path=url & "\" & foldername      '新建文件夹的全部路径!
	if instr(path,"..") then
		Response.Redirect "error.asp?id=7"
		Response.End
	end if
	Set fs = Server.CreateObject("Scripting.FileSystemObject")
	if fs.FolderExists(path) or fs.FileExists(path) then          '检查文件名是否存在!
%>
<html><head><Title>发生错误……</title>
<META content="text/html; charset=gb2312" http-equiv="Content-Type" />
</head><body>该文件名已经存在!点<a href="javascript:history.back(1)">这里</a>返回!
</body>
</html>
<%	else
		fs.CreateFolder(path)      '新建文件夹!
                dim str
                 str=server.urlencode(session("zipath"))
             %>
             <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
           <script language=javascript>
           alert("创建成功!");
           parent.list.location.href="list.asp?url=<%=str%>";
          this.location.href="upload.asp";
         </script>
      <%       response.end
         end if
  else
	Response.Redirect "error.asp"
	Response.End
  end if
%>
<%
 function checkname(str)      '检查输入的文件名是否合法
        if str="" then
			checkname=false
			exit function
		end if
 		l=Len(str)
		for i=1 to l
			a = mid(str,i,1)
			if a="\" or a="/" or a=":" or a="'" or a="*" or a="?" or a="""" or a="<" or a=">" or a="|" then
				checkname=false
				Exit Function
			end if
		next
		checkname=True
  end function
%>

⌨️ 快捷键说明

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