673
27
بناء مشاريع PHP و MySQL عملية
الجزء V
case 'select-account' :
// if have chosen a valid account, store it as a session variable if($account&&account_exists($auth_user, $account))
{
$selected_account = $account;
session_register('selected_account');
}
}
// set the buttons that will be on the tool bar $buttons[0] = 'view-mailbox';
$buttons [1]='new-message';
$buttons [2]
=
'account-setup';
//only offer a log out button if logged in if(check_auth_user())
{
$buttons [4] = 'log-out';
}
//**
// Stage 2: headers
*********
// Send the HTML headers and menu bar appropriate to current action //*
if($action)
{
// display header with application name and description of page or action do_html_header($auth_user, "Warm Mail
}
else
{
format_action($action), $selected_account);
}
// display header with just application name
do_html_header ($auth_user. "Warm Mail", $selected_account);
display_toolbar ($buttons);
//**************
// Stage 3: body
**********:
// Depending on action, show appropriate main body content //*************
*******
***************
//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
ص٦٥٧