|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
优点:简单易学、开发速度快、有很多年“历史”,能找到非常多别人做好的程序来用、配合activeX功能强大,很多php做不到的asp+activeX能做到,例如银行安全控件网下去的代码,,略微修正了一些中央,实在用的是cache类。。
保留代码为,好比pic.asp
利用:http://www.xxx.com/pic.asp?url=http://www.aaaa.com/log.gif
不但是163,实在就是良多防盗连的图片都能够这个完成。
<%
盗链判别
IfInstr(Request.ServerVariables("http_referer"),"http://"&Request.ServerVariables("server_name")&"")=0Then
Response.Write"不法链接"
Response.End
EndIf
Dimurl,body,myCache
url=Request.QueryString("url")
SetmyCache=newcache
myCache.name="picindex"&url
IfmyCache.validThen
body=myCache.value
Else
body=GetWebData(url)
myCache.addbody,dateadd("d",1,now)
EndIf
IfErr.Number=0Then
Response.CharSet="UTF-8"
Response.ContentType="application/octet-stream"
Response.BinaryWritebody
Response.Flush
Else
Wscript.EchoErr.Description
Endif
获得数据
PublicFunctionGetWebData(ByValstrUrl)
Dimcurlpath
curlpath=Mid(strUrl,1,Instr(8,strUrl,"/"))
DimRetrieval
SetRetrieval=Server.CreateObject("Microsoft.XMLHTTP")
WithRetrieval
.Open"Get",strUrl,False,"",""
.setRequestHeader"Referer",curlpath
.Send
GetWebData=.ResponseBody
EndWith
SetRetrieval=Nothing
EndFunction
cache类
classCache
privateobjcache内容
privateexpireTime过时工夫
privateexpireTimeName过时工夫application名
privatecacheNamecache内容application名
privatepathurl
privatesubclass_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
endsub
privatesubclass_terminate()
endsub
publicpropertygetblEmpty
是不是为空
ifisempty(obj)then
blEmpty=true
else
blEmpty=false
endif
endproperty
publicpropertygetvalid
是不是可用(过时)
ifisempty(obj)ornotisDate(expireTime)then
valid=false
elseifCDate(expireTime)<nowthen
valid=false
else
valid=true
endif
endproperty
publicpropertyletname(str)
设置cache名
cacheName=str&path
obj=application(cacheName)
expireTimeName=str&"expires"&path
expireTime=application(expireTimeName)
endproperty
publicpropertyletexpires(tm)
重设置过时工夫
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
endproperty
publicsubadd(var,expire)
赋值
ifisempty(var)ornotisDate(expire)then
exitsub
endif
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
endsub
publicpropertygetvalue
取值
ifisempty(obj)ornotisDate(expireTime)then
value=null
elseifCDate(expireTime)<nowthen
value=null
else
value=obj
endif
endproperty
publicsubmakeEmpty()
开释application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
endsub
publicfunctionequal(var2)
对照
iftypename(obj)typename(var2)then
equal=false
elseiftypename(obj)="Object"then
ifobjisvar2then
equal=true
else
equal=false
endif
elseiftypename(obj)="Variant()"then
ifjoin(obj,"^")=join(var2,"^")then
equal=true
else
equal=false
endif
else
ifobj=var2then
equal=true
else
equal=false
endif
endif
endfunction
endclass
%>对于中小型web应用来说,php有很强的竞争力,linux+apache+mysql+php(lamp)的组合几乎可以胜任绝大多数网站的解决方案,对于大型应用来讲,对于系统架构要求更高,需要有成熟的框架支持,jsp的struts是个不错的框架,国内介绍它的资料也非常多,应用逐渐广泛起来。asp就不用说了, |
|