Specifications
As with other places where we directly refer to $HTTP_POST_VARS, you need to have
track_vars enabled for this to work. We process the user’s card, and, if all is successful,
destroy her session.
The card processing function as we have written it simply returns true.
When you set up a live site, you will need to make a decision about what transaction clearing
mechanism you want to use. You can
• Sign up with a transaction clearing provider. There are many, many alternatives here
depending on the area you live in. Some of these will offer real-time clearing, and others
won’t. Whether you need live clearing depends on the service you are offering. If you are
providing a service online, you will most likely want it; if you are shipping goods, it’s
less crucial. Either way, these providers relieve you of the responsibility of storing credit
card numbers.
• Send a credit card number to yourself via encrypted email, for example, by using PGP or
GPG as covered in Chapter 15. When you receive and decrypt the email, you can process
these transactions manually.
• Store the credit card numbers in your database. We do not recommend this option unless
you really, seriously know what you’re doing with system security. You can read Chapter
15 for more details about why this is a bad idea.
That’s it for the shopping cart and payment modules.
Implementing an Administration Interface
The administration interface we have implemented is very simple. All we have done is build a
Web interface to the database with some front end authentication. This is much of the same
code as used in Chapter 24. We have included it here for completeness, but with little discus-
sion.
The administration interface requires a user to log in via the login.php file, which then takes
her to the administration menu, admin.php. Th login page is shown in Figure 25.11. (We have
omitted the login.php file here for brevity—it’s almost exactly the same as the one in Chapter
24. If you want to look at it, it’s on the CD-ROM.) The administration menu is shown in
Figure 25.12.
Building a Shopping Cart
C
HAPTER 25
25
B
UILDING A
SHOPPING CART
575
31 7842 CH25 3/6/01 3:39 PM Page 575










