Specifications

email (subject), and the listid of the list it has been sent to or will be sent to. The actual text
or HTML of the message could be a large file, so we will store the archive of the actual mes-
sages outside the database. We will also track some general status information: whether the
message has been sent (status), when it was sent (sent), and a timestamp to show when this
record was last modified (modified).
Finally, we use the images table to track any images associated with HTML messages. Again,
these images can be large, so we will store them outside the database for efficiency. Instead,
we will track the mailid they are associated with, the path to the location where the image is
actually stored, and the MIME type of the image (mimetype), for example, image/gif.
The SQL shown previously also sets up a user for PHP to connect as, and an administrative
user for the system.
Script Architecture
As in the last project, we have used an event-driven approach to this project. The backbone of
the application is in the file index.php. This script has four main segments, which are
1. Preprocessing: Do any processing that must be done before headers can be sent.
2. Set up and send headers: Create and send the start of the HTML page.
3. Perform action: Respond to the event that has been passed in. As in our last example,
the event is contained in the $action variable.
4. Send footers.
Almost all of the applications processing is done in this file. The application also uses the
function libraries listed in Table 28.1, as mentioned previously.
The full listing of the index.php script is shown in Listing 28.2.
LISTING 28.2 index.phpMain Application File for Pyramid-MLM
<?
/**********************************************************************
* Section 1 : pre-processing
*********************************************************************/
include (‘include_fns.php’);
session_start();
$buttons = array();
//append to this string if anything processed before header has output
Building a Mailing List Manager
C
HAPTER 28
28
BUILDING A
MAILING LIST
MANAGER
663
34 7842 CH28 3/6/01 3:46 PM Page 663