伦理片hd-伦理片 在线播放-伦理片 在线-伦理免费在线观看-综合图片区-综合婷婷

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

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

深山行者個人網(wǎng)站 2009/8/17 9:14:52 深山行者 字體: 瀏覽 4955

<%
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文件,位于當(dāng)前頁面目錄<%=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;注:解開的所有文件都位于當(dāng)前頁面目錄<%=Server.MapPath(".")%>下。也可以親自使用本系統(tǒng)附帶的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("服務(wù)器不支持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
%>

相關(guān)閱讀
全站托管解決方案
asp實現(xiàn)獲得當(dāng)前文章的上一篇信息與下一篇信息功能及代碼
連云港酒店預(yù)訂網(wǎng)站
設(shè)置兩個未知高度的DIV保持等高
CSS Alpha透明代碼相關(guān)知識學(xué)習(xí)
httpd.ini一些參數(shù)說明
從空格談起--關(guān)于CSS模塊化設(shè)計
asp加載xml 用于驗證目標(biāo)網(wǎng)站是否更新
共有0條關(guān)于《asp在線把整站打包成為.mdb形式文件》的評論
發(fā)表評論
正在加載評論......
返回頂部發(fā)表評論
呢 稱:
表 情:
內(nèi) 容:
評論內(nèi)容:不能超過 1000 字,需審核,請自覺遵守互聯(lián)網(wǎng)相關(guān)政策法規(guī)。
驗證碼: 驗證碼 
網(wǎng)友評論聲明,請自覺遵守互聯(lián)網(wǎng)相關(guān)政策法規(guī)。

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

更多信息>>欄目類別選擇
百度小程序開發(fā)
微信小程序開發(fā)
微信公眾號開發(fā)
uni-app
asp函數(shù)庫
ASP
DIV+CSS
HTML
python
更多>>同類信息
ASP中Utf-8與Gb2312編碼轉(zhuǎn)換亂碼問題的解決方法頁面編碼聲明
asp顯示隨機密碼
通過阿里云服務(wù)接口獲得ip地址詳細(xì)信息
iis點開后任務(wù)欄上有顯示,但是窗口看不到的解決辦法
RSA加密解密插件
微軟Encoder加密解密函數(shù)
更多>>最新添加文章
dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
Android移動端自動化測試:使用UIAutomatorViewer與Selenium定位元素
抖音直播音掛載小雪花 懂車帝小程序
javascript獲取瀏覽器指紋可以用來做投票
火狐Mozilla Firefox出現(xiàn):無法載入您的Firefox配置文件 它可能已經(jīng)丟失 或是無法訪問 問題解決集合處理辦法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路徑
python通過代碼修改pip下載源讓下載庫飛起
python里面requests.post返回的res.text還有其它的嗎
更多>>隨機抽取信息
獲得當(dāng)前頁面的長寬高各項參數(shù)
旅行社巴黎游主題模板效果
asp正則替換內(nèi)容里的CSS樣式
利用CSS中的Clip屬性來創(chuàng)造各種多彩的文字
景點門票預(yù)訂
向各位網(wǎng)友匯報下許愿墻進(jìn)程。
主站蜘蛛池模板: 四虎4h| 黑人视频在线观看 | 九九视频在线播放 | 四虎影院官网 | 黄频网站 | 香蕉蕉亚亚洲aav综合 | 可以免费看污片的网站 | 91高端极品外围在线观看 | 日韩欧美网址 | 一级毛片免费在线播放 | 操操综合| 亚洲成在人天堂在线 | 99热最新网站地址获取 | 国产福利免费 | 欧美综合自拍亚洲综合图片区 | 四虎91| 男女男精品视频在线播放 | 亚洲精品高清视频 | 亚洲第二区 | 国产精品亚洲欧美一级久久精品 | 国产国片精品jk制服 | 亚洲国产成人在线 | 久久久免费精品视频 | 亚洲免费在线 | 99热这里只有精 | 日韩欧美一区二区三区不卡视频 | 特级毛片aaa免费版 特级毛片aaaa免费观看 | 欧美日韩高清一区二区三区 | 麻豆国产精品有码在线观看 | 天堂素人在线 | 青热久思思 | 国产极品白嫩超清在线观看 | 欧美四虎 | 久久精品国产日本波多麻结衣 | 日日摸夜夜添夜夜免费视 | 欧美日本中文 | 久久大陆 | 在线观看精品视频一区二区三区 | 亚洲综合91社区精品福利 | 亚洲区视频在线观看 | 亚洲大胆美女人体一二三区 |