Specifications

LISTING 28.15 Continued
$buttons[0] = ‘change-password’;
$buttons[1] = ‘create-list’;
$buttons[2] = ‘create-mail’;
$buttons[3] = ‘view-mail’;
$buttons[4] = ‘log-out’;
$buttons[5] = ‘show-all-lists’;
$buttons[6] = ‘show-my-lists’;
$buttons[7] = ‘show-other-lists’;
do_html_header(“Pyramid-MLM - Upload Files”);
display_toolbar($buttons);
// check that the page is being called with the required data
if(!$userfile_name[0]||!$userfile_name[1]||!$subject||!$list)
{
echo “Problem: You did not fill out the form fully. The images are the
only optional fields. Each message needs a subject, text version
and an HTML version.”;
do_html_footer();
exit;
}
if(!db_connect())
{
echo “<p>Could not connect to db”;
do_html_footer();
exit;
}
// add mail details to the DB
$query = “insert into mail values (NULL, ‘$admin_user’,
‘$subject’,
‘$list’,
‘STORED’, NULL, NULL)”;
$result = mysql_query($query);
if(!$result)
{
do_html_footer();
exit;
}
//get the id MySQL assigned to this mail
$mailid = mysql_insert_id();
if(!$mailid)
{
Building a Mailing List Manager
C
HAPTER 28
28
BUILDING A
MAILING LIST
MANAGER
699
34 7842 CH28 3/6/01 3:46 PM Page 699