13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Defining the Script Architecture<br />

697<br />

Listing 30.2<br />

Continued<br />

// get rid of session variables<br />

session_destroy();<br />

display_account_form();<br />

break;<br />

case 'store-account':<br />

if (store_account($_SESSION['normal_user'],<br />

$_SESSION['admin_user'], $_POST)) {<br />

$action = '';<br />

}<br />

if(!check_logged_in()) {<br />

display_login_form($action);<br />

}<br />

break;<br />

case 'log-in':<br />

case '':<br />

if(!check_logged_in()) {<br />

display_login_form($action);<br />

}<br />

break;<br />

case 'show-all-lists':<br />

display_items('All Lists', get_all_lists(), 'information',<br />

'show-archive','');<br />

break;<br />

case 'show-archive':<br />

display_items('Archive For '.get_list_name($_GET['id']),<br />

get_archive($_GET['id']), 'view-html',<br />

'view-text', '');<br />

break;<br />

case 'information':<br />

display_information($_GET['id']);<br />

break;<br />

}<br />

//all other actions require user to be logged in<br />

if(check_logged_in()) {<br />

switch ($action) {<br />

case 'account-settings':

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!