Home arrow ASP arrow Page 4 - Make Revenue With Your Own Banner Management System

Make Revenue With Your Own Banner Management System

In this article Mitchell shows us how to develop a simple ad campaign and management system using ASP and an SQL Server database.

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 33
November 01, 2001
  1. · Make Revenue With Your Own Banner Management System
  2. · Adding the banners
  3. · Saving the banners
  4. · The ASP to add the banner
  5. · The ASP to add the banner (contd)
  6. · Listing the banners
  7. · Deleting a banner
  8. · Displaying and tracking banners, impressions and click-thrus
  9. · The code in detail
  10. · Handling the banner clicks
  11. · Conclusion

print this article

Make Revenue With Your Own Banner Management System - The ASP to add the banner
(Page 4 of 11 )

If you were paying attention over the last page or two, you would remember that our "Add a Banner" form posts our form data to addbanner2.asp. We'll create the addbanner2.asp page with the following code snippets (again, don't worry if you don't understand it, it will all make sense at the end of the article):

<%@ Language="VBScript" %>

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

If you've had even the smallest amount of exposure to ASP, you should be familiar with the <%@ Language=”VBScript” %> directive. This directive is optional, but should be included. It simply lets the ASP engine know that our page will contain VBScript code and not Jscript.

The next tag may look unfamiliar. This is a special type of tag called a server-side include (or SSI for short). This tag tells the ASP engine to extract all constants and variables (knows as a type library) from the msado15.dll file (located in the c:\program files\common files\system\ado) directory on our web server. Msado15.dll (MSADO15 - Microsoft ActiveX Data Objects version 1.5) contains all of the constants that we will be using when we declare our database objects, such as cursor types, lock types, etc.

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

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

set objUpload = Server.CreateObject("Persits.Upload.1")

strBanner_Path = "c:\inetpub\wwwroot\banners"

objUpload.OverwriteFiles = True

objUpload.Save strBanner_Path

The three "set ..." lines instantiate the database and upload objects that our script uses to handle our data. The first two set commands declare our database connection and recordset objects, which will be used to connect to and update our database respectively. The next line, set objUpload = Server.CreateObject("Persits.Upload.1") makes reference to our ActiveX object which will handle the uploading of our banner image. The ActiveX component is called Persits ASP Upload and can be downloaded from http://www.persits.com. Once you have downloaded the self-extracting executable, it's just a simple matter of running the install program and restarting your web server.

Moving on, the strBanner_Path variable will hold the location of the directory in which we want our banners to reside once they have been uploaded. This should be a sub-directory of the directory holding your ASP scripts on the server (for example, if my scripts were located in c:\myscripts, I would use something like c:\myscripts\images for the images directory. Make sure the directory for your images exists before you run the script!). Change this variable if you need to. After this, we just set our Persits upload component to overwrite image files if they already exist, and set the save parameter to the strBanner_Path variable.
blog comments powered by Disqus

- 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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials