Due February 20th, 11:59pm
As with all homeworks, you will submit this project in a two-step process:
- First, place all source code (stylesheets, html, php files, and your mysql table creation scripts) in a single h2 directory. You will submit this homework under the unique id h2 using turnin per the instructions on the course homepage.
- You will also put your assignment up on your personal webspace on z. Per the FAQ for z, you'll need to place these files in /u/z/users/cs105-s13/YOURCSID/h2.
Make sure your name, email address, and eid are in a comment at the top of each file you submit.
For this assignment, you'll be integrating a mysql database into the social networking site you created for the first homework. You'll be using the database to implement persistent relationships between the members of your network. You'll also be using sessions and cookies to give users a smooth experience while navigating the network. Of course, this submission needs to retain the functionality of the previous one.
For this assignment, you need to implement these two key features in the following ways:
- Using sessions to keep track of users.
- The index of your website will now be a login page (think facebook) on which users can enter their username and password to login. Logging in will start a new session and take users to their profile. There should also be a link to the signup page.
- Include a toolbar on each webpage that has a link which takes the logged-in user to their profile, a link to edit their profile, a link to the search feature (see below), and a link to log out (end the session).
- Posting a message on a profile now requires someone to be logged in- a message will now display when it was posted and who posted it.
You need to design a database to store network information. There
should be at least three tables:
- A user information table: user ids, passwords, profile info.
- A messages table for storing posted messages. In addition to the message, you need to keep track of who posted the message and when it was posted.
- A connection table that stores friendship relationships.
- The signup page now needs to collect a user id. Email address are fine for ids. Your validation procedures should be updated to check that this id is not already in the user database. Thus, each row in the users table should have a unique id (*cough* these would be ideal primary keys *cough*). Validated data should now be inserted into the database. Instead of showing the profile, a successful signup can just take users to a page thanking them for signing up.
- You still need a page for editing profiles, but the form should now be populated with data from the database. You should use session variables to ensure that only a logged-in user can edit their profile.
- The profile page should now use the database to get profile information. I would suggest designing the php page to use GET to identify the user id to display. This will let you provide links to specific profiles by putting ids in the url. You will also need to display a list of all messages posted to a user's wall by querying the messages table.
- Profile pages should now have an "add friend" button, if there is a user currently logged in (you should use session variables to check this). Friend relationships should be added to the database.
- Profile pages should now display a list of a user's friends.
Add privacy setting to messages. Users can select a privacy level when posting a message- 'friends' or 'everybody'. The profile webpage should use session info to determine whether or not to display a message. If no one is logged in, only 'everybody' messages should be displayed.