DMS315 s12/hw2
Homework, due Thursday, 9 February, 11:59 pm
Implement a very basic blog.
The project will consist of two scripts plus a form (which can be either an HTML page or a PHP script).
- One script displays the content of the blog
- At the end of the displayed blog there should be a link to the form
- The form allows adding new entries to the blog. There should be at least two fields in the form - a multi-line text area for the entry, and a text input for the poster's name. All fields should be labelled.
- The form will post its contents to a script, which appends the new entry to the existing blog and then displays a link back to the first page (the blog contents)
- Each blog entry should start with one line containing the poster's name and the date it was posted, followed by the text. The name & date should be formatted differently from the text (use CSS or appropriate HTML tags).
Implementation notes:
- Save the blog contents in a text file - whenever a new entry is posted, it is added to the end of the file.
- You have to get the date yourself and add it to the posting - search the PHP manual for an appropriate function
- All pages should be valid HTML, which passes the W3's validator with no errors (warnings are ok)
Some more advanced tricks to consider (not required):
- The script that adds a new entry can redirect browsers back to the main blog page using PHP's header() command, rather than displaying a link
- Sanitize all input, to remove any HTML code that might contain Javascript injection attacks
- Structure the text file so that your blog-display script processes it and adds the HTML markup on the fly. With a structured file you could add options like showing only the last few entries, or showing entries in reverse-chronological order.
Submit your assignment in a single zip or tar file using the form: http://gamera.caset.buffalo.edu/~depape/315/turnin.html