star Phase 2 star


Due September 19th, 10:00pm

star Assignment star

For this assignment, you'll be using php to dynamically generate and modify the pages of your photo gallery. I suggest that you use your static html pages from the first assignment as templates for this phase.

In order to make these sites interesting, I'm providing a simple php library to save / load php arrays to disk. It's entirely possible that this library has some bugs I haven't squashed; please post to piazza if you have any trouble. The next phase will migrate to mysql for data storage, so your pages won't be using this library for long.

This requirements for this assignment fall into two broad categories:

  1. Using php to generate pages dynamically using an database.
  2. Using php to process forms to add new data to the database. All data should be validated before the database is modified.


Requirement Value
(15pt Total)
Dynamic Page Generation 7pt Total

PHP-Generated Profiles, Galleries, and Photos

You need to generate photo galleries, picture pages, and profiles dynamically using php. Each script will use GET to obtain the album/photo/profile id of the album/photo/profile to display. This will allow you to link to specific pages, as we've discussed in class. I suggest you store the data for these sites as associative arrays so that you can use the library mentioned above.


PHP-Generated Homepage

You need to implement a homepage for your gallery (named index.php, of course). This homepage should have a list of users and links to the signup, album creation, and photo upload pages listed below. Each user names should link to his/her profile.

Form Handling 8pt Total

Sign-up Form and Handler

The first form will be a signup page for people to register with your photo gallery:

  • This script will use a form to collect the registrant's name, some sort of password, and whatever additional bits of information you need to properly fill out the profile page. This form should use the post method to send its data to the handler.
  • The form handler will need to validate passwords. Your form should use two password input elements so your script can validate them against each other by comparing the two passwords to make sure they are equal. It also needs to ensure the password meets some simple security guidelines which you come up with (i.e. it contains both a numeral and a punctuation mark, etc.) You should include these guidelines on the page with the form.
  • If the password validation fails, or if the user fails to input a required piece of data, the handler needs to send the user back to the page with the signup form. (The easiest way to do this is to use the same php script to both generate and handle the form). The handler should put all the correctly entered information back into the form elements so that the user doesn't have to reenter them. The page should also indicate what went wrong.
  • If the data is good, the handler should save the data.

Photo Uploading and Handler

A form that uploads a new picture to an album. This form should collect a picture file, a picture title, an album name, and the password of the user to which that album belongs. The handler should validate the password against the user password in the database. Again, if validation fails, the handler should output the original form with a note about what went wrong and add the photo to the album otherwise.


Album Creation and Handler

Another form to create a new album. This form should simply take an album name, the name of the user to which the album belongs, and the user's password. To validate the data, the handler should ensure that a valid user is given and that the password matches that user's. If validation fails, the handler should output the original form with a note about what went wrong. Otherwise, the new (empty) album should be added to the gallery.

Bonus Points 1pt Total

Implement one of the suggested changes from the critique of Phase 1. Include a readme.txt file with your submission explaining how you implemented the change.


star Submission Instructions star

As with all homeworks, you will submit this project in a two-step process: