仓酷云

标题: ASP网站制作之ASP在线晋级程序 [打印本页]

作者: 活着的死人    时间: 2015-1-16 22:05
标题: ASP网站制作之ASP在线晋级程序
帮助用户快速实现各种应用服务,ASP商有整合各方面资源的能力,可在短期内为用户提供所需的解决方案。例如,典型的ERP安装,如果要在客户端安装的话需要半年到二年的时间,但是美国的一些ASP商如USI和CORIO能在90—120天内提供ERP应用方案。ASP在线晋级程序<%
文件名:updata.asp
远程地点
consturl="http://localhost/test/"
action=request("action")
ifaction="updata"then
download(url&"config.txt")
download(url&"pack.jpg")
response.Write("下载乐成<ahref=updata.asp?action=install>安装</a>")
elseifaction="install"then
str=openfile("config.txt")
ifstr=""then
response.write"短少当地设置文件config.txt"
else
size=RegExpTest("size",str)
callinstall("pack.jpg",size)
endif
else
str=getpage(url&"config.txt")
ifstr=""then
response.write"不存在可用更新大概当地设置不准确"
response.end
endif
str1=openfile("config.txt")
ifstr1=""then
response.write"短少当地设置文件config.txt没法获知当地程序的安装工夫"
response.end
endif
updatatime=RegExpTest("time",str)
updatatime1=RegExpTest("time",str1)
ifDateDiff("d",updatatime1,updatatime)>0then
response.Write("存在可用更新,更新日期:"&updatatime&"<ahref=updata.asp?action=updata>下载</a>")
else
response.write"您的程序是最新的了"
endif
endif
functionopenfile(filename)
setfso=server.CreateObject("scripting.filesystemobject")
iffso.fileexists(server.MapPath(filename))then
setf1=fso.opentextfile(server.mappath(filename),1,true)
openfile=f1.readall
f1.close
else
openfile=""
endif
setfso=nothing
endfunction
functiongetpage(url)
setxmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open"get",url,false
xmlhttp.send
ifxmlhttp.status200then
getpage=""
else
getpage=bytes2BSTR(xmlhttp.ResponseBody)
endif
endfunction
Functionbytes2BSTR(vIn)
dimstrReturn
dimi,ThisCharCode,NextCharCode
strReturn=""
Fori=1ToLenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
IfThisCharCode<&H80Then
strReturn=strReturn&Chr(ThisCharCode)
Else
NextCharCode=AscB(MidB(vIn,i+1,1))
strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
i=i+1
EndIf
Next
bytes2BSTR=strReturn
EndFunction
FunctionRegExpTest(patrn,strng)
DimregEx,Match,Matches创建变量。
SetregEx=NewRegExp创建正则表达式。
regEx.Pattern=patrn&"=(.+?)
"设置形式。
regEx.IgnoreCase=True设置是不是辨别字符巨细写。
regEx.Global=True设置全局可用性。
SetMatches=regEx.Execute(strng)实行搜刮。
ForEachMatchinMatches遍历婚配汇合。
RetStr=Match.Value
Next
RegExpTest=replace(RetStr,patrn&"=","")
EndFunction
functiondownload(url)
temp=split(url,"/")
filename=temp(ubound(temp))
setxmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open"get",url,false
xmlhttp.send
ifxmlhttp.status200then
download=""
else
setfso=server.createobject("scripting.filesystemobject")
iffso.fileexists(server.mappath(filename))then
fso.deletefile(server.mappath(filename))
endif
setfso=nothing
img=xmlhttp.ResponseBody
setobjAdostream=server.createobject("ADODB.Stream")
objAdostream.Open
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(server.mappath(filename))
objAdostream.SetEOS
setobjAdostream=nothing
download=filename
endif
setxmlhttp=nothing
endfunction

functioninstall(filename,size)
onerrorresumenext
path=server.mappath("./")
setfso=server.createobject("scripting.filesystemobject")
sets=server.createobject("adodb.stream")
sets1=server.createobject("adodb.stream")
sets2=server.createobject("adodb.stream")
s.open
s1.open
s2.open
s.type=1
s1.type=1
s2.type=1
s.loadfromfile(server.mappath(filename))
s.position=size
s1.write(s.read)
s1.position=0
s1.type=2
s1.charset="gb2312"
s1.position=0
a=split(s1.readtext,vbcrlf)
s.position=0
i=0
while(i<ubound(a))
b=split(a(i),">")
ifb(0)="folder"then
ifnotfso.folderexists(path&b(2))then
fso.createfolder(path&b(2))
endif
elseifb(0)="file"then
iffso.fileexists(path&b(2))then
fso.deletefile(path&b(2))
endif
s2.position=0
s2.write(s.read(b(1)))
s2.seteos
s2.savetofile(path&b(2))
endif
i=i+1
wend
s.close
s1.close
s2.close

<p>缺乏可以共同遵循的行业标准,ASP还处在发展初期,大家对它的理解不同,如产品和服务标准,收费标准等,不利于行业的健康发展。
作者: 不帅    时间: 2015-1-18 20:13
学习ASP其实应该上升到如何学习程序设计这种境界,其实学习程序设计又是接受一种编程思想。比如ASP如何学习,你也许在以前的学习中碰到过。以下我仔细给你说几点:
作者: 因胸联盟    时间: 2015-1-27 19:46
还有如何才能在最短的时间内学完?我每天可以有效学习2小时,双休日4小时。
作者: 若相依    时间: 2015-2-5 15:05
下载一个源代码,然后再下载一个VBScript帮助,在源代码中遇到不认识的函数或是其他什么程序,都可以查帮助进行解决,这样学习效率很高。
作者: 兰色精灵    时间: 2015-2-12 10:46
代码逻辑混乱,难于管理:由于ASP是脚本语言混合html编程,所以你很难看清代码的逻辑关系,并且随着程序的复杂性增加,使得代码的管理十分困难,甚至超出一个程序员所能达到的管理能力,从而造成出错或这样那样的问题。
作者: 若天明    时间: 2015-3-3 03:15
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
作者: 再见西城    时间: 2015-3-11 09:38
那么,ASP.Net有哪些改进呢?
作者: 谁可相欹    时间: 2015-3-25 17:40
代码逻辑混乱,难于管理:由于ASP是脚本语言混合html编程,所以你很难看清代码的逻辑关系,并且随着程序的复杂性增加,使得代码的管理十分困难,甚至超出一个程序员所能达到的管理能力,从而造成出错或这样那样的问题。




欢迎光临 仓酷云 (http://ckuyun.com/) Powered by Discuz! X3.2