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.

688 Chapter 30 Building a Mailing List Manager<br />

The solution components fall under these general goals:<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

Administrators should be able to set up <strong>and</strong> modify mailing lists.<br />

Administrators should be able to send text <strong>and</strong> HTML newsletters to all the subscribers<br />

of a single mailing list.<br />

Users should be able to register to use the site, <strong>and</strong> enter <strong>and</strong> modify their details.<br />

Users should be able to subscribe to any of the lists on the site.<br />

Users should be able to unsubscribe from lists they are subscribed to.<br />

Users should be able to store their preference for either HTML-formatted or<br />

plain-text newsletters.<br />

For security reasons, users should not be able to send mail to the lists or to see<br />

each other’s email addresses.<br />

Users <strong>and</strong> administrators should be able to view information about mailing lists.<br />

Users <strong>and</strong> administrators should be able to view past newsletters that have been<br />

sent to a list (the archive).<br />

Now that you know the idea behind the project, you can begin designing the solution<br />

<strong>and</strong> its components, such as setting up a database of lists, subscribers, <strong>and</strong> archived<br />

newsletters; uploading newsletters that have been created offline; <strong>and</strong> sending mail with<br />

attachments.<br />

Setting Up a Database of Lists <strong>and</strong> Subscribers<br />

In this project, you track the usernames <strong>and</strong> passwords of all system users, as well as a list<br />

of the lists they have subscribed to.You also store each user’s preference for receiving text<br />

or HTML email so that you can send a user the appropriate version of the newsletter.<br />

An administrator is a specialized user with the ability to create new mailing lists <strong>and</strong><br />

send newsletters to those lists.<br />

A nice piece of functionality to have for a system like this is an archive of previous<br />

newsletters. Subscribers might not keep previous postings but might want to look up<br />

something. An archive can also act as a marketing tool for the newsletter because potential<br />

subscribers can see what the newsletters are like.<br />

You will find nothing new or difficult in setting up this database in <strong>MySQL</strong> <strong>and</strong> an<br />

interface to it in <strong>PHP</strong>.<br />

Uploading Newsletters<br />

You need an interface to allow the administrator to send newsletters, as mentioned previously.What<br />

we haven’t discussed is how the administrator will create that newsletter.<br />

You could provide him with a form where he could type or paste the newsletter

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

Saved successfully!

Ooh no, something went wrong!