13.09.2016 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Defining the Script Architecture<br />

701<br />

In the final section of the index.php script, you send an HTML footer using the<br />

do_html_footer() function from output_fns.php.<br />

Let’s look briefly at an overview of the possible actions in the system.These actions<br />

are shown in Table 30.2.<br />

Table 30.2 Possible Actions in the Mailing List Manager Application<br />

Action Usable By Description<br />

log-in Anyone Gives a user a login form<br />

log-out Anyone Ends a session<br />

new-account Anyone Creates a new account for a user<br />

store-account Anyone Stores account details<br />

show-all-lists Anyone Shows a list of available mailing lists<br />

show-archive Anyone Displays archived newsletters for a particular list<br />

information Anyone Shows basic information about a particular list<br />

account-settings Logged-in users Displays user account settings<br />

show-other-lists Logged-in users Displays mailing lists to which the user is not subscribed<br />

show-my-lists Logged-in users Displays mailing lists to which the user is subscribed<br />

subscribe Logged-in users Subscribes a user to a particular list<br />

unsubscribe Logged-in users Unsubscribes a user from a particular list<br />

change-password Logged-in users Displays the change of password form<br />

store-change- Logged-in users Updates a user’s password in the database<br />

password<br />

create-mail Administrators Displays a form to allow upload of newsletters<br />

create-list Administrators Displays a form to allow new mailing lists to be<br />

created<br />

store-list Administrators Stores mailing list details in the database<br />

view-mail Administrators Displays newsletters that have been uploaded but<br />

not yet sent<br />

send Administrators Sends newsletters to subscribers<br />

One noticeable omission from Table 30.2 is an option along the lines of store-mail—<br />

that is, an action that actually uploads the newsletters entered via create-mail by<br />

administrators.This single piece of functionality is actually in a different file, upload.php.<br />

We put this functionality in a separate file because it makes keeping track of security<br />

issues a little easier on us, the programmers.<br />

Next, we discuss the implementation of the actions in the three groups listed<br />

in Table 30.2—that is, actions for people who are not logged in, actions for logged-in<br />

users, <strong>and</strong> actions for administrators.

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

Saved successfully!

Ooh no, something went wrong!