Specifications
//display any text generated by functions called before header
echo $status;
if(!check_auth_user())
{
echo “<P>You need to log in”;
if($action&&$action!=’log-out’)
echo “ to go to “.format_action($action);
echo “.<br><br>”;
display_login_form($action);
}
else
{
switch ( $action )
{
// if we have chosen to setup a new account, or have just added or
// deleted an account, show account setup page
case ‘store-settings’ :
case ‘account-setup’ :
case ‘delete-account’ :
{
display_account_setup($auth_user);
break;
}
case ‘send-message’ :
{
if(send_message($to, $cc, $subject, $message))
echo “<p>Message sent.<br><br><br><br><br><br>”;
else
echo “<p>Could not send message.<br><br><br><br><br><br>”;
break;
}
case ‘delete’ :
{
delete_message($auth_user, $selected_account, $messageid);
//note deliberately no ‘break’ - we will continue to the next case
}
case ‘select-account’ :
case ‘view-mailbox’ :
{
// if mailbox just chosen, or view mailbox chosen, show mailbox
display_list($auth_user, $selected_account);
break;
}
case ‘show-headers’ :
case ‘hide-headers’ :
Building Practical PHP and MySQL Projects
P
ART V
626
LISTING 27.2 Continued
33 7842 CH27 3/6/01 3:41 PM Page 626










