Click to return to the Server Technologies home page    
Web Workshop  |  Server Technologies

Classifieds Site Code Download and Installation

Wayne Berry
Editor, 15 Seconds

April 14, 1998

Download Download the classifieds site code

Contents
Introduction
Install IIS 4.0
XSession
XCheck
Configure SQL Server
Configure ODBC
Modify the Global Variables
Modify the Text
Modify the Logo
Summary

Introduction

This article provides the installation instructions for building your own classifieds site with the downloadable code. The site is completely customizable, so you can create your own theme, regions, and categories. You will need to have access to Internet Information Server (IIS) and Microsoft SQL Server to run the classifieds site. You will also need to know HTML, graphics, SQL Server, IIS, and Active Server Pages (ASP) to customize the site.

Install IIS 4.0

This site is written with ASP and designed to run on IIS 4.0. To run the code, you will need to download and configure IIS 4.0.

Download IIS

IIS is part of the Windows® NT 4.0 Option Pack. You can download the Windows NT 4.0 Option Pack from this location:

http://www.microsoft.com/ntserver/web/default.asp Non-MSDN Online link

The Option Pack needs to be installed on top of Windows NT 4.0 Service Pack 3.0 and Windows NT Server. Once installed, you can begin configuring the Web site.

Configuring IIS

The code that you can download assumes that you have a separate domain for your classifieds site. All the files are located in a single directory that is the root of that domain. References to the files also assume that the files are located in the root of a domain. Get a single IP and configure Windows NT to service that IP. Using Microsoft data source name (DNS) Server, map the domain name to the IP. Now you can configure IIS to listen for requests and issue responses. Use the following instructions to configure your IIS machine:

  1. Open Internet Service Manager.
  2. Select the machine that you are using.
  3. Right-click that machine, choose New, and then Web Site.
  4. Type Classified in for the Web Site Name and click the Next button.
  5. Select the IP that you are going to use and click Next.
  6. Create a directory on the hard drive under "inetpub" and select this directory, then click Next.
  7. Click Finish.

Turn off sessions

You will not need IIS to maintain the built-in session state, because the Session object is not used. The session state is enabled by default, and for performance reasons you should turn it off if you are not using it. Here is how to turn the session state off:

  1. Open Internet Service Manager
  2. Select the Web site that you just created.
  3. Right-click it and select Properties.
  4. Click the Home Directory tab.
  5. Click the Configuration button.
  6. Click the App Option tab.
  7. Uncheck the Enable Session State check box.
  8. Click OK.
  9. Click OK again.

Installing the Files

All the files in the download should be placed in the directory that you created for the Web site. This is the same directory to which you mapped the IP.

TopBack to top

XSession

XSession is used to keep the session state of the classifieds site and to maintain state across the user's visits. For example, when the user first visits the site a welcome message appears. However, on repeat visits this message doesn't appear. This information is kept in a file store that is accessed through XSession.

Installing XSession

You can download XSession from this URL:

ftp://ftp.signmeup.com/xsession.zip Non-MS link

Once you have it downloaded, you'll need to install the component:

  1. Copy XSession.dll to the System directory, which is by default c:\winnt\system32.
  2. Open a command window.
  3. Change the directory until you are in the system directory.
  4. Type the following command to register XSession:
regsvr32 XSession.dll
    

There is a 30-day trial for this component. This will allow you to test the site without initially purchasing the component. To purchase the component, click the link below:

http://www.swregnet.com/1643p.htm Non-MS link

Configure XSession

By default XSession will write the data store at:

c:\winnt\system32\inetsrv\XSession

If you wish to change this location, you can do so by changing the registry key at:

HKEY_LOCAL_MACHINE\SOFTWARE\SMUM\XSession\Parameters\Root

Depending on the traffic you are getting, the data store could get quite large, so take this into consideration with its placement. Also, if you are running two servers in a Web farm, you will want to point both servers to the same data store on one of the servers.

For more information about XSession go to:

http://www.signmeup.com/XSession.stm Non-MS link

TopBack to top

XCheck

XCheck is used verify the form input before allowing a post to go to the Web site. Using XCheck reduces the cost of maintaining the Web site, because each post does not need to be checked individually by the administrator -- ads can automatically go live on the site.

You can download XSession from this URL:

ftp://ftp.signmeup.com/xcheck.zip Non-MS link

To install the component:

  1. Copy XCheck.dll to the System directory, by default c:\winnt\system32.
  2. Open a command window.
  3. Change the directory until you are in the system directory.
  1. Type the following command to register XCheck:
    regsvr32 XCheck.dll
    

There is a 30-day trial for this component. This will allow you to test the site without initially purchasing the component. To purchase the component, click the link below:

http://www.swregnet.com/875p.htm Non-MS link

For more information about XCheck go to:

http://www.signmeup.com/XCheck.stm Non-MS link

TopBack to top

Configure SQL Server

The classifieds site uses SQL Server extensively to generate the advertisements and the dynamic drop-down menus. For this reason, we recommend running SQL Server on a separate machine than the Web server.

Create a Database

The first thing you need to do is create a database to hold the tables that will be used for the site. For a medium-size site with 100-200 ads, you will need a 100-megabyte database device with a separate 50-megabyte log device.

Run the SQL Scripts

Once you have the database created, you can run the SQL script that comes with the download. The name of the script is setup.sql. To run the script, follow the steps listed below:

  1. Close SQL Enterprise Manager if it is open.
  2. Open ISQL_w.
  3. Log in with the "sa" account.
  4. Choose the database you created for the classifieds site from the drop-down menu at the top.
  5. Load the setup.sql by clicking File and then Open.
  6. Execute setup.sql by clicking the Run button in the toolbar.
This script will create the post, section, region, and subsection tables with foreign key references and primary key indexing. It will also create a user called usr_classified and give that user permission to access the tables. Finally, it populates the table with some default data so that you have something to work with.

Populate the Database

The setup.sql script creates some default data that you can work with, however you will want to customize the site to your own needs. You can change the regions displayed, and the categories and the subcategories of ads.

You can modify the region table so that the right regions are included. For example, you might want to create an apartment classifieds for your city. The region table would then contain the different communities within your city.

Modifying the section table and the subsection table changes the categories that ads can go into. Depending on the site you are running, these tables will have different data. With the apartment example, you might want to make main sections with apartment styles -- studio, townhouse, shared living -- and subsections that are price ranges.

TopBack to top

Configure ODBC

Create a DSN

You will want to create a system DSN on the machine that is running the Web server. The DSN name should be "classified". This DSN is used by Active Server Pages to connect to the database, so point the DSN to the SQL Server with the default database being the one you created.

Change sql.asp

sql.asp contains the name of the DSN, the user name to use when logging into the SQL server, and the password for that user. This file is included in every ASP file that needs to make database calls. By default they are set like this:

Const SQLDSN = "classified"
    Const SQLUser = "usr_classified"
    Const SQLPassword = ""
    

If you change the DSN name, the user name, or the password, you will have to modify this file to match the changes. It is important to note that because this page is named with an asp extension it will always be executed if the script is turned on. In other words, there is no way for anyone to read this file and get your user name or password to the SQL server database.

TopBack to top

Modify the Global Variables

There are several global variables that are used throughout the Web site. These are contained in the global.asp file, which (like sql.asp), is included in all the main pages. To modify these global variables, make changes to the global.asp. You must modify gstrCustServiceEmail, gstrServer, and gstrSiteName to make the site operate properly; the rest are used to customize the site.

Change the Customer Service E-mail Address

To set the customer service e-mail addresses, modify the global variable called gstrCustServiceEmail. Note here the Hungarian notation that tells us this is a global string.

Change the Server Variable

The JScript™ in the pages references the root of the server and needs the full URL to activate the pop-up windows. You will have to modify the global variable called gstrServer to be your domain name.

Change the Site Name

You will need to modify the site name. It is set in the global variable called gstrSiteName.

Change the Maximum Word Count

glMaxTextWordCount limits the amount of text that can be posted for each posting. Set glMaxTextWordCount to 200 to limit the postings to 200 words.

Change the Maximum Title Length

glMaxTitleWordCount represents the maximum number of words in the title of each posting.

Modify the Empty Message

Where there are no postings for the page, the message in gstrEmtpy is displayed to the user. By default it is set to "There are no advertisements for this section, keyword, or region."

Mouseover Message

When you mouse over one of the postings, the message in gstrClickOn is displayed. By default it reads "Click on the advertisement for more information."

Performance Settings

glInsertSizeIncrement is used to allocate memory for the array that arranges the postings on the page. Setting glInsertSizeIncrement too low will cause the page to have to reallocate memory too often. Setting glInsertSizeIncrement too high will raise the memory requirements of the site. By default, glInsertSizeIncrement is set to 75. If you think that you will have more than 75 postings per page, you should raise this setting.

glNewDays is the number of days that a posting is considered new and receives the new logo next to the posting. Postings that are younger than glNewDays from the current date are displayed on the entrance page to the site. If this setting is too low and no postings are this new, the Web page will return to the SQL Server to get advertisements that are glNewDays older than glNewDays. This causes an additional round trip to the SQL Server. If glNewDays is too high, there will be too many ads on the entrance page, causing the page to load too slowly for the user. You need to set glNewDays based on the number of postings you are receiving on the site. The default is 2 days.

If there are only glNewAdMin postings to display that are new, the ASP will return to the SQL Server to find more postings. This setting prevents your entrance page from appearing empty when there are not many new postings. Setting glNewAdMin too low will create an empty look; setting it too high will cause extra work for SQL Server, degrading your performance. The default setting is 10 postings.

Column Settings

You can change the number of columns displayed on the site by changing glColumns. By default, glColumns is set to four columns. You can also change the width of those columns with the glColumnWidth setting. By default, the setting is 185 pixels. The default settings are set so that the site is viewable with a maximized Internet Explorer browser with a screen resolution of 800 x 600.

Color Settings

gstrBodyBGColor, gstrPColor, gstrSColor, gstrTColor, gstrButtonColor, gstrButtonDarkColor, gstrButtonLightColor, gstrButtonEdgeColor, gstrHighlightColor, gstrTextColor, gstrInverseTextColor and gstrVLinkColor control the color settings for the site. You can change these setting to match your brand or create them for your site. There are additional notes about the settings in the global.asp file.

TopBack to top

Modify the Text

Customize the Welcome Text

When the user first comes to the site, a welcome message is displayed in a modal dialog box. The same text is used when the user chooses About from the More Info menu. This text is in a file called welcome_text.asp. You will have to modify this file to contain the greeting you wish the user to see. This page is not displayed directly, but is referenced from other ASP pages.

Modify the Copyright Information

The copyright information is contained in a file called footer.asp. You will need to add your company information to the copyright text.

Modify the Legal Text

You will need to change the legal text that is displayed to the user when they click on the copyright at the bottom of the page, or when the user chooses Legal Notice from the More Info menu. This text is contained in popup_legal.txt.

Modify the New Post Text

The instructions that are presented to the user when they are posting to the site should be customized to reflect the theme and style of your site. You can change the text by changing the newpost_text.asp file.

TopBack to top

Modify the Logo

You will need to create a logo for the header. You can do this by changing the logo.gif image. Make sure to change the height and width setting in the header.asp file to match the size of your new graphic.

TopBack to top

Summary

Once you've completed all the steps above, you should be able to run your new classifieds site. If you create an Internet site with this code, drop us a line at webmaster@15Seconds.com so that we can take a look at your handiwork.

See also the downloadable classifieds site code and the article on the 15 Seconds Job Classifieds Technical Architecture. If you are interested in MSDN Online membership so you can access contact information on the site and post job openings, see the Community home page.

15 Seconds Non-MS link is a free Internet resource for developers working with Microsoft Internet Solutions and product lines of Sign Me Up Marketing Non-MS link SMUM, a leader in Internet marketing. Established in 1996, SMUM is a Seattle-based business owned by Wayne Berry, a well-known global programming consultant and co-author of Active X Programming Unleashed, Windows NT 4 Registry, and IIS 4.0 Special Edition.



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.