|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
问题是他们究竟是喜欢他们是使用软件时,速度快还是速度慢好.(当然在3秒以内).无论是他们输入资料时,查找资料时,分析资料时.告白ChristopherMiller
转载:ASP佳构屋钱丰云
起首你必要一个数据库安排你的告白,我们共用了2个表:blBanners和tblVendors表:
tblBanners布局表以下:
bID-autonumber(告白ID)
bBanner-text(图象文件)
bUsedViews-number(#尺度的告白显现次数)
bTotalViews-number(#ofimpressionsthevendorhaspaidfor)
bClicks-number(#尺度的告白点击次数)
bURL-text(网站URL)
bShow-yes/no(用来标识告白是显现仍是埋没)
vID-number(买主ID)
tblVendors表布局以下:
vID-autonumber(买主ID-链到tblBanners.vID)
vName-text(买主的名字)
etc..........
第一步
如今,这个数据库已创建了,你必要有随机地在我们的网页中显现告白而且盘算显现次数。:
DSN链接不讲了,假如不会,你能够到以下地点看看:
http://www.askasp.com/toolbox.asp?Expand=True&ID=2#tool
假如是SQL,能够接纳上面的类似语句:
SQL="SELECTtblBanners.bID,tblBanners.bImage,tblBanners.bUsedViews,tblBanners.bLastViewed"
SQL=SQL&"FROMtblBanners"
SQL=SQL&"WHERE(((tblBanners.bShow)=True)AND((tblBanners.bTotalViews)>[tblBanners].[bUsedViews]));"
在下面的SQL语句中,只要当bShow标记是True并且UsedViews(显现客户告白次数)小于TotalViews(客户总显现告白次数)的
纪录才作拔取(上面不翻译了,深夜了:)。
Nowthatwehaveallofthebannersthatwecandisplay,weneedtodisplayarandomone.Wecandothis
bygrabbingthetotalnumberofbanners,movingtothefirstrecord,andthemovingtoarandomnumber,
forexample:
DimrndMax,rndNumber
Randomize
rndMax=Int(RecordSet.RecordCount)
rndNumber=Int(RND*rndMax)
RecordSet.MoverndNumber
Nowthatwehavemovedtoourrandombanner,wenowneedtodisplaythebanneronourpage(Iamsureyou
knowhowtodothat,soIwontboreyouwiththedetails).However,InsteadofusingthebannersURLin
thelink,wearegoingtousearedirectpagesowecancounttheclicks.Allweneedtodoisusethe
bannerIDintheHREFtag,forexample:
ahref="redirect.asp?ID=<%=BANNERID%>"
Nowthatwehavethelinksetup,wecanmoveontoourredirect.asppage.Onthispage,wearegoingto
grabtheIDthatwearepassingintheQueryString,andgrabbingtheRecordSetthatmatches.Oncewehave
theRecordSet,wecangrabthebannersURL,increasetheClicksby1,andsendtheusertothe
destinationURL.Belowisthecodefortheredirect.asppage:
<%
IfRequest.QueryString("ID")=""Then
Response.Redirect("default.asp")
EndIf
DimvarSiteToRedirect,varURLToRedirect
varSiteToRedirect=Int(Request.QueryString("ID"))
SQL="SELECTtblBanners.bID,tblBanners.bURL,tblBanners.bClicks"
SQL=SQL&"FROMtblBanners"
SQL=SQL&"WHERE(((tblBanners.bID)="&varSiteToRedirect&"));"
varDatabaseName="ask_asp_data.mdb"
%>
<!--#includefile="common/data_conn_open.asp"-->
<%
IfNotRecordSet.BOFThen
RecordSet.MoveFirst
EndIf
varURLToRedirect=RecordSet.Fields("bURL")
RecordSet.Fields("bClicks")=(RecordSet.Fields("bClicks")+1)
RecordSet.Update
%>
<!--#includefile="common/data_conn_close.asp"-->
<%Response.Redirect(varURLToRedirect)%>
</p>asp可以使用微软的activeX使得网页功能无比强大,不过安全性也较差,而且是基于的windows服务器,所以性能稳定性也一般 |
|