动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP实例
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP实例 ]的信息



本月文章推荐
.Delphi编写组件封装asp代码的基本.
.WSH 直接将查询数据结果生成 EXC.
.一个BBS的源代码(六).
.用ASP开发一个在线考试程序(九).
.网上“店铺”DIY(1) .
.一个基于web的QQ程序 1(xml+asp.
.创建一个Web投票系统.
.ASP进阶之文章在线管理更新(8).
.读取目录下的所有文件(源码).
.用ASP实现对Web搜索引擎Index Se.
.一个新版本的ubb转化程序.
.中文分词搜索,asp拆词搜索,asp智.
.怎样做自己的二级域名(之一).
.一个简单的网上书城的例子(二).
.用asp怎样编写文档搜索页面(1).
.XMLHTTP+Javascript+Asp写得聊天.
.ASP环境下邮件列表功能的实现 (.
.利用ASP实现对表的分页浏览(上).
.无组件图文混合上传示例.
.ASP中DLL的调试环境配置全攻略 .

建立一个广告交换及跟踪系统

发表日期:2001-9-19 |


First you need a database to store your banners. We are using 2 tables; tblBanners and tblVendors:

tblBanners:
bID - auto number (banner ID)
bBanner - text (image file)
bUsedViews - number (# of views the banner has received)
bTotalViews - number (# of impressions the vendor has paid for)
bClicks - number (# of clicks the banner has received)
bURL - text (URL of the site)
bShow - yes/no (used to show and hide banners)
vID - number (vendor ID)

tblVendors:
vID - autonumber (vendor ID - links to tblBanners.vID)
vName - text (Vendor's name)
etc..........


Now that the database is set up, we need to randomly display the banner on our pages and increment the 'views' by 1:

First you need to open your database connection on the page you want your banner to be viewed on. We use a DSN-less connection; you can find it at the following address:

http://www.askasp.com/toolbox.asp?Expand=True&ID=2#tool

Here is what the SQL might look like:

SQL = "SELECT tblBanners.bID, tblBanners.bImage, tblBanners.bUsedViews, tblBanners.bLastViewed "
SQL = SQL & "FROM tblBanners "
SQL = SQL & "WHERE (((tblBanners.bShow)=True) AND ((tblBanners.bTotalViews)>[tblBanners].[bUsedViews]));"

In the above SQL, we are checking for the 'bShow' flag to be True, and that the UsedViews is less than the TotalViews.

Now that we have all of the banners that we can display, we need to display a random one. We can do this by grabbing the total number of banners, moving to the first record, and the moving to a random number, for example:


Dim rndMax, rndNumber

Randomize

rndMax = Int(RecordSet.RecordCount)
rndNumber = Int(RND * rndMax)

RecordSet.Move rndNumber


Now that we have moved to our random banner, we now need to display the banner on our page (I am sure you know how to do that, so I wont bore you with the details). However, Instead of using the banner's URL in the link, we are going to use a redirect page so we can count the clicks. All we need to do is use the banner ID in the HREF tag, for example:

a href="redirect.asp?ID=<%= BANNER ID %>"

Now that we have the link set up, we can move on to our redirect.asp page. On this page, we are going to grab the ID that we are passing in the Query String, and grabbing the RecordSet that matches. Once we have the RecordSet, we can grab the banner's URL, increase the Clicks by 1, and send the user to the destination URL. Below is the code for the redirect.asp page:

<%
If Request.QueryString("ID") = "" Then
Response.Redirect("default.asp")
End If

Dim varSiteToRedirect, varURLToRedirect

varSiteToRedirect = Int(Request.QueryString("ID"))


SQL = "SELECT tblBanners.bID, tblBanners.bURL, tblBanners.bClicks "
SQL = SQL & "FROM tblBanners "
SQL = SQL & "WHERE (((tblBanners.bID)=" & varSiteToRedirect & "));"

varDatabaseName = "ask_asp_data.mdb"
%>

<!--#include file="common/data_conn_open.asp"-->

<%
If Not RecordSet.BOF Then
RecordSet.MoveFirst
End If

varURLToRedirect = RecordSet.Fields("bURL")

RecordSet.Fields("bClicks") = (RecordSet.Fields("bClicks") + 1)
RecordSet.Update
%>

<!--#include file="common/data_conn_close.asp"-->

<% Response.Redirect(varURLToRedirect) %>


上一篇:XMLHTTP+Javascript+Asp写得聊天室,无刷新实现(六) 人气:15949
下一篇:如何制作无状态的ASP组件 人气:10613
浏览全部广告的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-8 ECShop v2.6.0 Build 20080707(G
2008-7-8 动网论坛PHP版 v2.0++ Build 080
2008-7-8 中国IT总舵 v9.0 UTF版
2008-7-8 凹丫丫新闻发布系统 v4.6 Build
2008-7-8 topview数据查询 v3.0
2008-7-8 Z-Blog v1.8 Spirit Build 80708
2008-7-8 Z-Blog v1.8 Spirit Build 80708
2008-7-8 凹丫丫新闻发布系统 v4.6 Build
2008-7-8 新动软万能网站内容管理cms系统
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 GoodCalculator2.0版固件计算器
2008-7-5 RepoName源地址搜索工具 v1.21b
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 TouchCopy多媒体管理软件 v3.13完
2008-7-5 VideosTone视频铃声 v1.1汉化破解
2008-7-5 TouchPad触摸板 v4.44破解版
2008-7-5 VideosTone破解补丁 v1.0
2008-7-5 Feeds GoogleReader客户端 v0.4.3


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報