Your job is to make an image-uploading service. Users of the service can upload images that then show up on the site home page. The home page should show the latest 50 images that have been uploaded.
Users have to log in to see your site. If they are not logged in, they are redirected to the login page.
-this means you need a sign-up page that allows users to register with username/password
The home page displays a list of the 50 latest images that were uploaded
-all images should show the image, a one-line caption, and the username of the user who uploaded it
Here is a step by step breakdown of the tasks that you have to accomplish in order to get this to work:
LOGIN PAGE
-if the user is already logged in, they are redirected to the home page
-otherwise...
-show one text input for username
-show one password input for password
-and a submit button
-this page submits data to a script that checks the login info
SCRIPT TO CHECK THE LOGIN INFO
-receive the data the user entered from the Login Page
-open the users.txt file and see if there are any rows in that file that match the username/password the user entered
-if there is a match, you set a cookie called "loggedin" and set it equal to "true", and then redirect them to the home page
-otherwise, if the login failed, you redirect them to the login page with a user-friendly error message
HOME PAGE
-checks to see if the "loggedin" cookie is equal to "true"
-if it is, you let them see the page
-if it's not, you redirect them to the login page, and show a user-friendly error message
-if they are logged in, you open the "images.txt" file, and load all the data in there
-loop through each line of the text file, and get the image filename, caption, and username associated with that image
-display each image with the caption underneath it along with the username of the user who uploaded that image
UPLOAD PAGE
-users must be logged in to see this page, otherwise they are redirected to the login page with a user-friendly error message
-has a file input for the file the user wants to upload
-has a text input for the caption
-you have to figure out how to get and store the username of the user who is uploading this file
-submits the data to a script called process_upload_image.php that does the actual uploading and storing of the data
PROCESS_UPLOAD_IMAGE.PHP SCRIPT
-checks to make sure the "loggedin" cookie is equal to "true"
-if the user is not logged in, they are redirected to the login page with a user-friendly error
-if they are logged in....
-this script receives the caption and file that the user uploaded
-this script moves that image file to a permanent directory
-you need to make sure you have a variable that stores the path of the where the file was moved to
-this script needs to store the caption, image file path, and username to a text file called "images.txt"
-each new uploaded image will create a new line in the text file
-if there is an error uploading, this page shows a nice user-friendly error message
-if the upload succeeds, it redirects them to the home page with a user-friendly error indicating that their upload succeeded
Saturday, November 1, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment