magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2001 > 11 > Development Feature  

Classified Action

By Ray Argus

Ideally, data-driven Web sites should let you separate content from presentation. Authors should create content without regard to how it will be displayed, letting designers manage the actual appearance of the page elements. But what happens when anyone with access to your site can create content?

Recently, a client asked me to build a classified ad system using PHP. The system needed to let users place their own ads online. But because that invites spam and other mischief, an administrator would have to approve the ads (after possibly processing a credit card for payment).

The system I devised can integrate with the PHP shopping cart that appeared in the November 2000 Web Techniques "Script Junkie" column I wrote with Jerid Freeland.

What's In an Ad?

To represent an ad, I created a database table. Each row contains one ad. Here are the fields:

  • catid. The category ID (each ad is, of course, in a classification).
  • adid. A unique ID for the ad (an auto increment or identity field).
  • exp. The expiration date and time of the ad.
  • title. The ad's title.
  • text. The main text of the ad (as a blob field).
  • response. The advertiser's email address.
  • graphicurl. An optional image to post with the ad.
  • posted. The posted time and date.
  • active. Set to 1 if the ad is approved for display.<>



  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2