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 > 2000 > 11 > Script Junkie  

Roll Out Your Cart

By Ray Argus and Jerid Freeland

Perhaps the most ubiquitous Web application is the venerable shopping cart. Recently, a small client of ours wanted a shopping cart that could be customized. After evaluating many possible solutions, we decided to make our own shopping cart using PHP. Along the way, we learned a lot of lessons about sessions, secure servers, and credit cards.

The Problems

When creating a shopping cart, developers will most likely come across a number of standard problems. One of the first we had to deal with for our client's application was that of keeping "state." The cart has to keep track of what the customer has ordered as he or she moves from page to page on the Web site. That means you must be able to monitor the user's state throughout the session. Prior to PHP4 you needed an external library like PHPLIB to track state. However, PHP4 has session handling built in, so we decided to use that. (We did borrow a database class from PHPLIB, however.)

The other major problem is getting the script to operate properly within the restrictions of a secure server. You want to protect your customers' credit card and personal information, but you don't want your entire site on a secure server because the extra processing time slows site speed. Another concern is that if your secure server and your main server are physically located on separate machines, then tracking state will be close to impossible.

Fortunately, the only page that has to be secure is the one receiving the credit card information.




  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