SunQuest
 
       ASP
  Home arrow ASP arrow Page 8 - Make Revenue With Your Own Banner Manageme...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Make Revenue With Your Own Banner Management System
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2001-11-01

    Table of Contents:
  • Make Revenue With Your Own Banner Management System
  • Adding the banners
  • Saving the banners
  • The ASP to add the banner
  • The ASP to add the banner (contd)
  • Listing the banners
  • Deleting a banner
  • Displaying and tracking banners, impressions and click-thrus
  • The code in detail
  • Handling the banner clicks
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Make Revenue With Your Own Banner Management System - Displaying and tracking banners, impressions and click-thrus


    (Page 8 of 11 )

    By now you should have created the four pages that I described in part one: addbanner1.asp, addbanner2.asp, banners.asp and delbanner.asp. You should save these pages in some sort of admin folder and use your Web server to configure the security permissions on this directory so that a username a password is required to access your banner scripts.

    Having said that, I'll now demonstrate the code we'll use to retrieve a banner from our database, display it on our Web page and track both impressions and click-thrus for each banner.

    Displaying a banner on your site:

    No doubt you've been to thousands of Websites that display banners across the top of the screen. These could be 468x60 banners, 460x60, 215x125 etc. The point is that banners are the most popular form of advertising on the Internet.

    To display a banner from the database on our site, four steps are required as pictured here:

    Four steps to display a banner on your site

    Create the following code and save it to a file called bannercode.asp

    <%@ Language="VBScript" %>

    <!-- METADATA Type="TypeLib" File="c:\program files\common files\system\ado\msado15.dll" -->

    <%

    function GetBanner()

    dim objConn

    dim objComm

    dim objRS

    dim strBanner_VirtualPath

    dim strBannerHTML

    dim intNumBanners

    dim intRandom

    set objConn = Server.CreateObject("ADODB.Connection")

    set objRS = Server.CreateObject("ADODB.Recordset")

    strBanner_VirtualPath = "/banners/"

    objConn.Open "Provider=SQLOLEDB; Data Source=localhost;Initial Catalog=myAdStuff; UId=sa; Pwd="

    objRS.ActiveConnection = objConn

    objRS.LockType = adLockReadOnly

    objRS.CursorType = adUseForwardOnly

    objRS.Open "select count(*) from banners"



    intNumBanners = objRS.Fields(0).Value

    if intNumBanners = 0 then

    exit function

    end if

    Randomize

    intRandom = int(rnd(1)*intNumBanners)

    objRS.Close

    objRS.Open "select * from banners"

    objRS.Move intRandom

    strBannerHTML = "<a href='bannerclick.asp?bannerId=" & objRS("bannerId") & "'><img border='0' src='" & strBanner_VirtualPath & objRS("bannerImage") & "'<>/a>"

    Response.Write strBannerHTML



    objConn.Execute "UPDATE banners SET bannerImpressions =bannerImpressions + 1 WHERE bannerId = " & objRS("bannerId")

    objConn.Close



    set objConn = nothing

    set objRS = nothing

    end function

    %>


    Now, let's break down the unfamiliar code...

    More ASP Articles
    More By Mitchell Harper


     

    ASP ARTICLES

    - Central Scoreboard with Flash and ASP
    - Calorie Counter Using WAP and ASP
    - Creating PGP-Encrypted E-Mails Using ASP
    - Be My Guest in ASP
    - Session Replacement in ASP
    - Securing ASP Data Access Credentials Using t...
    - The Not So Ordinary Address Book
    - Adding and Displaying Data Easily via ASP an...
    - Sending Email From a Form in ASP
    - Adding Member Services in ASP
    - Removing Unconfirmed Members
    - Trapping HTTP 500.100 - Internal Server Error
    - So Many Rows, So Little Time! - Case Study
    - XDO: An XML Engine Class for Classic ASP
    - Credit Card Fraud Prevention Using ASP and C...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway