Visit the Official PHP Website |
PHP ProgrammingBy James N HitzIt's Reaping Time... Again!As we did earlier, we hereby describe our intention before we embark on the coding: ObjectiveOur objective is to create a mailing list on to which members can either subscribe or unsubscribe. When subscribing, we request the user's First name, Last name and email address and then record them into a file. In this file each entry will be on its own line and the items will follow each other and will be separated by a pipe symbol (|) like so: first name| last name | email address As an after-thought, I also added a mechanism through which webmasters can view the entire mailing list. This is best placed in a different file that the webmaster will have exclusive access to, so as to keep your mailing list from prying snoops. In this case though, we'll put all the code in one file. We will create a stipulation that an email address can only exist ONCE in our mailing list. When un-subsribing, the user only supplies as a minimum, their email address. The line of text containing their details is then removed from the file. Be fore-warned though. The following example is not necessarily the best implementation of a guestbook (also not the worst). It has been made un-necessarily longer so as to set out examples of how specific functions can be used. A few new functions are also introduced in the example and explained later. Also note that this example is not modular. (This is handled in the next lesson). It works, it's royalty-free - so tweak it! Ok... Let's begin. Shall we? |
JamHitz Productions