变态重口极致另类在线-波多久久夜色精品国产-波多野结衣在线观看一区-波多野结衣在线观看一区二区-污污的网站免费阅读-污污视频网址

當前位置:首頁文章首頁 IT學院 IT技術

ASP升級程序的介紹及使用說明

作者:  來源:  發布時間:2011-6-13 15:16:51  點擊:

 這篇文章主要介紹的是關于ASP升級程序的介紹及使用說明,希望能對大家有所幫助。

<%
'文件名:updata.asp
'遠程地址
const url="http://localhost/test/"

action=request("action")
if action="updata" then
 download(url&"config.txt")
 download(url&"pack.jpg")
 response.Write("下載成功<a href='updata.asp?action=install'>安裝</a>")
elseif action="install" then
 str=openfile("config.txt")
 if str="" then
  response.write "缺少本地配置文件config.txt"
 else
  size=RegExpTest("size",str)
  call install("pack.jpg",size)
 end if
else
 str=getpage(url&"config.txt")
 if str="" then
  response.write "不存在可用更新或者本地配置不正確"
  response.end
 end if

 str1=openfile("config.txt")
 if str1="" then
  response.write "缺少本地配置文件config.txt無法獲知本地程序的安裝時間"
  response.end
 end if

 updatatime=RegExpTest("time",str)
 updatatime1=RegExpTest("time",str1)

 if DateDiff("d",updatatime1,updatatime)>0 then
  response.Write("存在可用更新,更新日期:"&updatatime&"<a href='updata.asp?action=updata'>下載</a>")
 else
  response.write "您的程序是最新的了"
 end if
end if

function openfile(filename)
set fso=server.CreateObject("scripting.filesystemobject")
if fso.fileexists(server.MapPath(filename)) then
 set f1=fso.opentextfile(server.mappath(filename),1,true)
 openfile=f1.readall
 f1.close
else
 openfile=""
end if
set fso=nothing
end function

function getpage(url)
set xmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open "get",url,false
xmlhttp.send
if xmlhttp.status<>200 then
 getpage=""
else
 getpage=bytes2BSTR(xmlhttp.ResponseBody)
end if
end function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function

Function RegExpTest(patrn,strng)
Dim regEx,Match,Matches'建立變量。
Set regEx = New RegExp'建立正則表達式。
regEx.Pattern = patrn&"=(.+?)\n"'設置模式。
regEx.IgnoreCase = True'設置是否區分字符大小寫。
regEx.Global = True'設置全局可用性。
Set Matches = regEx.Execute(strng)'執行搜索。
For Each Match in Matches'遍歷匹配集合。
RetStr = Match.Value
Next
RegExpTest = replace(RetStr,patrn&"=","")
End Function

function download(url)
 temp=split(url,"/")
 filename=temp(ubound(temp))
 set xmlhttp=server.createobject("Microsoft.XMLHTTP")
 xmlhttp.open "get",url,false
 xmlhttp.send
 if xmlhttp.status<>200 then
  download=""
 else
  set fso=server.createobject("scripting.filesystemobject")
  if fso.fileexists(server.mappath(filename)) then
   fso.deletefile(server.mappath(filename))
  end if
  set fso=nothing
  img=xmlhttp.ResponseBody
  set objAdostream=server.createobject("ADODB.Stream")
  objAdostream.Open
  objAdostream.type=1
  objAdostream.Write(img)
  objAdostream.SaveToFile(server.mappath(filename))
  objAdostream.SetEOS
  set objAdostream=nothing
  download=filename
 end if
 set xmlhttp=nothing
end function


function install(filename,size)
on error resume next
path=server.mappath("./")

set fso=server.createobject("scripting.filesystemobject")

set s=server.createobject("adodb.stream")
set s1=server.createobject("adodb.stream")
set s2=server.createobject("adodb.stream")

s.open
s1.open
s2.open

相關軟件

文章評論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
主站蜘蛛池模板: 日韩精品视频网站 | 一级二级黄色片 | 丁香综合在线 | 欧美日韩不卡一区 | 在线观看黄色小视频 | 人人公开免费超级碰碰碰视频 | 婷婷亚洲综合五月天在线 | 国产日韩精品欧美一区视频 | 欧美亚洲日本一区 | 99re免费视频精品全部 | 国产一区欧美 | 99福利影院 | 视频一区 中文字幕 | 日本天堂在线播放 | 国产成年人视频 | 欧美巨大xxxx做受孕妇视频 | 日韩国产欧美一区二区三区 | 1769国产精品视频免费观看 | 欧美理论片在线观看一区二区 | 婷婷亚洲综合五月天小说 | fxxxx性欧美高清 | 亚洲视频在线观看免费 | 无遮挡男女激烈免费动态图 | 亚洲欧美一区二区三区在线播放 | 一区二区三区在线 | 欧 | 日韩 欧美 亚洲 国产 | 国产视频福利在线 | 高清一级做a爱过程免费视频 | aaa毛片手机在线现看 | 国产一二三四区中 | 特黄特色一级aa毛片免费观看 | 人人澡人人透人人爽 | 亚洲成年网站在线观看 | 成熟女人免费一级毛片 | 91精品国产肉丝高跟在线 | 美女黄网站在线观看 | 羞羞视频导航 | 久色视频网 | 曰本一区二区 | 久久影院秋霞理论 | 亚洲日本精品va中文字幕 |