天天射射天天_久久com_99这里只有精品视频_爱色av_国产在线a_99日韩

訂閱本欄目 RSS您所在的位置: 深山工作室 > ASP > 正文

asp在線把整站打包成為.mdb形式文件

深山行者個人網站 2009/8/17 9:14:52 深山行者 字體: 瀏覽 4922

<%
Function IsInteger(Para)
 IsInteger=False
 If Not (IsNull(Para) Or Trim(Para)="" Or Not IsNumeric(Para)) Then
  IsInteger=True
 End If
End Function

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>asp在線把整站打包成為.mdb形式文件</title>
<style type="text/css">
<!--
body{font-family: "宋體","Times New Roman", Times, serif; font-size:12px; text-align:center;}
td,select{font-size:12px;}
.table{border-left:1px #999999 solid;}
.trtrb{border-top:1px #999999 solid;border-right:1px #999999 solid; border-bottom:1px #999999 solid;}
.trtr{border-top:1px #999999 solid;border-right:1px #999999 solid;}
.tx{font-family: "宋體";font-size:12px;border:1px solid;border-color:black black #000000;color: #0000FF;}
.button{border:1px #666666 solid; background-color:#FFFFFF; height:18px;}
-->
</style>
</head>
<body leftmargin="0">
<%
dim act,thePath
act=lcase(trim(request("action")))
if act="combine" then
   '用ASP將文件分割器分割的文件合并
   dim fname,f,newname
   newname=request("newname")
   set f=request("f")
   for i=1 to f.count
 if f(i)<>"" then
  fname=fname&"|"&f(i)
 end if
   next
   if newname="" then
 call back("新文件名不能為空!")
   end if
   if fname="" then
 call back("需合并文件名不能全為空!")
   end if
   call combine(fname,newname)
elseif act="addtomdb" or act="releasefrommdb" then
 thePath = Request("thePath")
 Script_TimeOut = trim(request("timeout"))
 if IsInteger(Script_TimeOut) then
  Script_TimeOut = round(Script_TimeOut*60,0)
 else
  Script_TimeOut = 3600
 end if
 Server.ScriptTimeOut = Script_TimeOut
 if act="addtomdb" then
  addToMdb(thePath)
  response.write "<script language=javascript>alert('操作完成!');window.close();</script>"
 elseif act="releasefrommdb" then
  unPack(thePath)
  response.write "<script language=javascript>alert('操作完成!');window.close();</script>"
 end if
end if
%>


<table width="542" border="0" cellspacing="0" cellpadding="0" align="center" class="table">
    <tr bgcolor="#CCCCCC">
      <td class="trtr" height="22" align="center" valign="middle" bgcolor="#CCCCCC"><B>ASP文件打包/解包器 v1.0 by 秋憶</B></td>
    </tr>
 <tr><td>
<table width="542" border="0" cellspacing="0" cellpadding="0" align="center">


<form method=post target=_blank action="<%=selfname%>">
  <tr height="30">
    <td class="trtr">&nbsp;文件夾打包:</td>
    <td class="trtr">&nbsp;
 <input type="text" name="thePath" value="<%=Server.MapPath(".")%>" class="tx" style="width:300px">
 <input type="hidden" value="addToMdb" name="action">
 <select name="theMethod">
 <option value="fso">FSO</option>
 <option value="app">無FSO</option>
 </select>
 </td>
  </tr>
  <tr>
    <td class="trtr" colspan="2" height="25" align="center">
 腳本超時:<input type="text" name="timeout" value="60" class="tx" style="width:40px" />分鐘  
 <input type="submit" value="開始打包" class="button">
 </td>
  </tr>
  <tr>
    <td class="trtr" colspan="2" height="30">&nbsp;注:打包生成Qiuyi.mdb文件,位于當前頁面目錄<%=Server.MapPath(".")%>下。</td>
  </tr>
  <tr>
    <td class="trtr" colspan="2" height="40">&nbsp;</td>
  </tr>
  </form>
 
 
</table>
</td></tr>
<tr><td>
<table width="542" border="0" cellspacing="0" cellpadding="0" align="center">
<form method=post target=_blank action="<%=selfname%>">
  <tr>
    <td class="trtr" nowrap="nowrap" height="30">&nbsp;文件夾解包(需FSO支持):</td>
    <td class="trtr" nowrap="nowrap">&nbsp;
 <input type="text" name="thePath" value="<%=Server.MapPath(".")%>\Qiuyi.mdb" class="tx" style="width:300px">
 <input type="hidden" value="releaseFromMdb" name="action">
 </td>
  </tr>
  <tr>
    <td class="trtr" colspan="2" height="25" align="center">
 腳本超時:<input type="text" name="timeout" value="60" class="tx" style="width:40px" />分鐘  
 <input type="submit" value="開始解包" class="button">
 </td>
  </tr>
  <tr>
    <td class="trtrb" colspan="2" height="30">&nbsp;注:解開的所有文件都位于當前頁面目錄<%=Server.MapPath(".")%>下。也可以親自使用本系統附帶的undo.vbs文件解開壓縮包。</td>
  </tr>
</form>
</table>
</td></tr>
</table>
<table width="542" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td align="center">
<span style='position:relative;top:4px; text-align:center;line-height:120%;'>
<%
endtime=timer()
if endtime<starttime then
 endtime=endtime+24*3600
end if
response.Write(copyright)
%><br>Processed in <%=(endtime-starttime)*1000%> MSEL
</span>
</td></tr>
</table>
</body>
</html>
<%

sub back(str)
 response.write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">" & vbcrlf
 response.write "<script language=javascript>alert('"& str &"');history.back();</script>"
 response.end
end sub

sub combine(Filename,newname)
 on error resume next
 dim n,i,fso,dr
 newname=server.MapPath(newname)
 Filename=split(Filename,"|")
 i=ubound(Filename)
 redim fstr(i)
 
 if Err then Err.Clear
 set fso = Server.CreateObject("Scripting.FileSystemObject")
 if not Err then
  for n=1 to i
     fname(n)=server.MapPath(Filename(n))
     if not fso.FileExists(fname(n)) then
   set fso=nothing
   call back("文件“"&replace(Filename(n),"\","\\")&"”找不到!")
     end if
  next
  set fso=nothing
 else
  Err.Clear
 end if
 
 if Err then Err.Clear
 set dr=Server.CreateObject("Adodb.Stream")
 if Err then
  Err.Clear
  call back("服務器不支持Adodb.Stream,無法使用合并功能!")
 end if
 for n=1 to i
    dr.Mode=3
    dr.Type=1
    dr.Open
    dr.LoadFromFile(fname(n))
    fstr(n)=dr.read
 next
 
 dr.Mode=3
 dr.Type=1
 dr.Open
 for n=1 to i
    dr.write=fstr(n)
 next
 dr.SaveToFile newname,2
 dr.Close
 set dr=nothing
 response.write "新文件<b>"&newname&"</b>成功生成!"
 if Err then
  Err.Clear
  Response.Write("<h1>Error: </h1>" & Err.Description & "<p>")
 end if
end sub

Sub addToMdb(thePath)
 On Error Resume Next
 Dim rs, conn, stream, connStr, adoCatalog
 set rs = Server.CreateObject("Scripting.FileSystemObject")
 if not rs.FolderExists(thePath) then
  set rs = nothing
  response.Write("目錄"&thePath&"不存在!")
  response.end
 end if
 set rs = nothing
 
 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=" & Server.MapPath("Qiuyi.mdb")
 
 adoCatalog.Create connStr
 conn.Open connStr
 conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
 
 stream.Open
 stream.Type = 1
 rs.Open "FileData", conn, 3, 3
 
 If lcase(trim(Request("theMethod"))) = "fso" Then
  fsoTreeForMdb thePath, rs, stream
  Else
  saTreeForMdb thePath, rs, stream
 End If
 
 rs.Close
 Conn.Close
 stream.Close
 Set rs = Nothing
 Set conn = Nothing
 Set stream = Nothing
 Set adoCatalog = Nothing
 if Err then
  Err.Clear
  Response.Write("<h1>Error: </h1>" & Err.Description & "<p>")
 end if
End Sub

Function fsoTreeForMdb(thePath, rs, stream)
 Dim item, theFolder, folders, files, sysFileList,fsoX
 sysFileList = "$Qiuyi.mdb$Qiuyi.ldb$"
 set fsoX = Server.CreateObject("Scripting.FileSystemObject")
 If fsoX.FolderExists(thePath) = False Then
  call back(thePath & " 目錄不存在或者不允許訪問!")
 End If
 Set theFolder = fsoX.GetFolder(thePath)
 Set files = theFolder.Files
 Set folders = theFolder.SubFolders
 
 For Each item In folders
  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 fsoX = Nothing
 Set files = Nothing
 Set folders = Nothing
 Set theFolder = Nothing
End Function

Sub saTreeForMdb(thePath, rs, stream)
  on error resume next
  Dim item, theFolder, sysFileList,saX
  sysFileList = "$Qiuyi.mdb$Qiuyi.ldb$"
  Set saX = Server.CreateObject("Shell.Application")
  Set theFolder = saX.NameSpace(thePath)
  
  For Each item In theFolder.Items
   If item.IsFolder = True Then
    saTreeForMdb item.Path, rs, stream
    Else
    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
   End If
  Next

  Set saX = Nothing
  Set theFolder = Nothing
  if Err then
   Err.Clear
   Response.Write("<h1>Error: </h1>" & Err.Description & "<p>")
  end if
End Sub

Sub unPack(thePath)
  On Error Resume Next
  'Server.ScriptTimeOut = 5000
  Dim rs, ws, str, conn, stream, connStr, theFolder,fsoX
  set rs = Server.CreateObject("Scripting.FileSystemObject")
  if not rs.FileExists(thePath) then
   set rs = nothing
   response.Write("文件"&thePath&"不存在!")
   response.end
  end if
  set rs = nothing

  str = Server.MapPath(".") & "\"
  Set rs = CreateObject("ADODB.RecordSet")
  Set stream = CreateObject("ADODB.Stream")
  Set conn = CreateObject("ADODB.Connection")
  connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & thePath & ";"

  conn.Open connStr
  rs.Open "FileData", conn, 1, 1
  stream.Open
  stream.Type = 1

  set fsoX = Server.CreateObject("Scripting.FileSystemObject")
  Do Until rs.Eof
   theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\"))
   If fsoX.FolderExists(str & theFolder) = False Then
    createFolder(str & theFolder)
   End If
   stream.SetEos()
   stream.Write rs("fileContent")
   stream.SaveToFile str & rs("thePath"), 2
   rs.MoveNext
  Loop

  rs.Close
  conn.Close
  stream.Close
  set fsoX = Nothing
  Set ws = Nothing
  Set rs = Nothing
  Set stream = Nothing
  Set conn = Nothing
  if Err then
   Err.Clear
   Response.Write("<h1>Error: </h1>" & Err.Description & "<p>")
  end if
End Sub

Sub createFolder(thePath)
  on error resume next
  Dim i,fsoX
  i = Instr(thePath, "\")
  set fsoX = Server.CreateObject("Scripting.FileSystemObject")
  Do While i > 0
   If fsoX.FolderExists(Left(thePath, i)) = False Then
    fsoX.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
  set fsoX = Nothing
  if Err then
   Err.Clear
   Response.Write("<h1>Error: </h1>" & Err.Description & "<p>")
  end if
End Sub
%>

相關閱讀
asp簡繁體轉換函數(含3500漢字對照表)
深山行者留言系統V3.3發布
武義熟溪溫泉旅行網
連云港華夏國際旅行社
各個蘋果手表型號版本對比以及查看蘋果手機Apple Watch型號
利用css中的scale()實現放大縮小效果
吉林省天馬旅行社
如何利用ASP清除所有的Application對象
共有0條關于《asp在線把整站打包成為.mdb形式文件》的評論
發表評論
正在加載評論......
返回頂部發表評論
呢 稱:
表 情:
內 容:
評論內容:不能超過 1000 字,需審核,請自覺遵守互聯網相關政策法規。
驗證碼: 驗證碼 
網友評論聲明,請自覺遵守互聯網相關政策法規。

您發布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權益;
二、不得發布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發布內容擁有處置權。

更多信息>>欄目類別選擇
百度小程序開發
微信小程序開發
微信公眾號開發
uni-app
asp函數庫
ASP
DIV+CSS
HTML
python
更多>>同類信息
ASP中Utf-8與Gb2312編碼轉換亂碼問題的解決方法頁面編碼聲明
asp顯示隨機密碼
通過阿里云服務接口獲得ip地址詳細信息
iis點開后任務欄上有顯示,但是窗口看不到的解決辦法
RSA加密解密插件
微軟Encoder加密解密函數
更多>>最新添加文章
dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
Android移動端自動化測試:使用UIAutomatorViewer與Selenium定位元素
抖音直播音掛載小雪花 懂車帝小程序
javascript獲取瀏覽器指紋可以用來做投票
火狐Mozilla Firefox出現:無法載入您的Firefox配置文件 它可能已經丟失 或是無法訪問 問題解決集合處理辦法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路徑
python通過代碼修改pip下載源讓下載庫飛起
python里面requests.post返回的res.text還有其它的嗎
更多>>隨機抽取信息
圖片上傳時,如果格式不正確,跳出警告
photoshop cs 3D變換濾鏡下載
經常使用到有關數據庫的操作sql
ASP常用內置函數(下)
黃河龍城2015最幸福情侶投票選舉
window.location.href跳轉無反應不跳轉解決
主站蜘蛛池模板: 久久亚洲精品国产亚洲老地址 | 免费一区二区视频 | 国产产一区二区三区久久毛片国语 | 午夜一区二区三区 | 精品国产91久久久久 | 国产伦精品一区二区三区高清 | 可以免费观看一级毛片黄a 另类国产精品一区二区 | 免费国产黄网站在线观看视频 | 免费a级在线观看完整片 | 久久成人国产精品免费 | 人人草人人澡 | 国产高清一区二区三区 | 99视频九九精品视频在线观看 | 国产在线观看入口 | 中文字幕欧美在线 | 欧美日韩综合精品一区二区三区 | 在线播放国产色视频在线 | 精品一区二区三区免费观看 | 国产偷亚洲偷欧美偷精品 | 国产最新进精品视频 | 国产视频首页 | 亚洲精品综合久久中文字幕 | 国产欧美一区二区 | 亚洲精品在线免费观看 | 亚洲欧美日本在线 | 广东东莞一级毛片免费 | 亚洲精品免费观看 | 国产高清一区二区 | 99久久精品费精品国产一区二区 | 干比网| 亚洲欧美视频在线观看 | 欧美性俄罗斯18精品 | 久久综合爱| 国产精品久久久久激情影院 | 一区二区不卡久久精品 | 欧美视频免费看 | 三级网站免费播放国语 | 成人国产精品久久久免费 | 99久久精品国产一区二区小说 | 足交在线观看 | 欧美人与性动交a欧美精品 欧美日本一道本 |