Specifications

display_new_message_form($auth_user, $to, $cc, $subject, $body);
}
break;
}
case ‘forward’ :
{
//set message as quoted body of current message
if(!$imap)
$imap = open_mailbox($auth_user, $selected_account);
if($imap)
{
$header = imap_header($imap, $messageid);
$body = add_quoting(stripslashes(imap_body($imap, $messageid)));
$subject = ‘Fwd: ‘.$header->subject;
imap_close($imap);
display_new_message_form($auth_user, $to, $cc, $subject, $body);
}
break;
}
case ‘new-message’ :
{
display_new_message_form($auth_user, $to, $cc, $subject, $body);
break;
}
}
}
//*****************************************************************************
// Stage 4: footer
do_html_footer();
//*****************************************************************************
?>
This script uses an event handling approach. It contains the knowledge or logic about which
function needs to be called for each event. The events in this case are triggered by the user
clicking the various buttons in the site, each of which selects an action. Most buttons are pro-
duced by the display_button() function, but the display_form_button() function is used
if its a submit button. These functions are both in output_fns.php. These all jump to URLs
of the form
index.php?action=log-out
The value of the $action variable when index.php is called determines which event handler to
activate.
Building Practical PHP and MySQL Projects
P
ART V
628
LISTING 27.2 Continued
33 7842 CH27 3/6/01 3:41 PM Page 628