ITECH3224 WWW Technology 2
Assignment 1 - Dog Share
This is an individual assignment in which you are required to develop a dynamic web application as described below.
Important: This assignment specification is generated just for you. Do not distribute this specification.
Timelines and Expectations
Percentage value of task: 20%
Due: Sun, Sep 17, 2017 - 16:00 (Week 7)
Learning Outcomes Assessed
The following course learning outcomes are assessed by completing this assessment:
K2. Contrast the capabilities and limitations of client-side and server-side programming.
S1. Develop client/server programs using client-side and server-side programming languages.
S2. Construct a server-side web interface to a database system that is accessible by web clients. A1. Design, develop, test, and debug client/server web applications to provided specifications.
For this assignment, you will create a web-based link sharing/aggregating platform, vaguely similar to -Reddit-. Your platform is dedicated to sharing interesting links about a particular topic - for your assignment the topic is Dog Share, a place for dog enthusiasts to share links about their shared interest.
Users can create accounts, share a dog-related link, and comment on the submissions of others.
The web application uses a relational database to create a review site. The database has the following structure:
User ( id, name, email, password )
DogLink ( id, user_id, datetime, link_url, title )
Comment ( id, user_id, doglink_id, comment_text )
Block ( user_id, blocked_user_id )
Primary keys are indicated with underlines or bold formatting, and foreign keys are italicized.
Each entry in the Dog table represents a single shared link made by a user.
Each record in the Comment table represents a comment on a post. A User may make multiple comments on a single DogLink, and each DogLink may have multiple Comments.
The Block table stores whether a User has blocked all communications from another User. If a record exists (1, 2) in Block, this means the user with id 1 should not see comments or posts from the user with id 2.
The following constraints should be applied when implementing the application:
The user_id and blocked_user_id in the Block table form a compound primary key, and both refer to the id field in the User table.
The datetime field should be stored as either a string or a MySQL datetime type, and must include both time and date.
The password field should be a VARCHAR of 255 characters. The name and email fields should be VARCHAR of a length that you determine to be reasonable and sufficient.
When the database is created, it should be populated with data of your own invention, appropriate to the theme. You should have at least:
8 dog links, with at least one link having 5 comments.
5 users (see note below)
One of the users must be you, using your student id - 30301130 - for the username, and your real name and email address. Invent other users as necessary - perhaps use characters from your favourite movie or band.
Also include a user with the username tutor and the password guest. This user must block at least one
Include this data as part of your written report.
Database creation DDL
Create an SQL file that creates the MySQL database, creates the four tables above, and populates them with your initial data.
Use your student id and course code as the database name as follows: ITECH3224_30301130.
Passwords should be hashed using, at minimum, the crypt() PHP function. Prefer to use the PHP password_hash() function to generate password hashes.
For the password 'guest', the following hash may be used in your database:
PASSWORD = '$2y$10$123031103030000999999uW9V.5Wf7qgnK8QEdmmTOc9ugkg7YvTO'
It is acceptable for all initial users to share the same password for testing.
Use of MD5 or SHA for password hashes is not acceptable.
Write SQL queries that display all of the initial data using SELECT statements, and include these queries in your report.
Write an HTML form that allows new users to sign up. The form should request a username, email address and password. The password must be hashed before storing it in the database.
Using PHP, validate that the username is unique, and the password is at least 5 characters (before hashing).
Write PHP code to allow users to log in and log out. This will require the use of sessions and/or cookies.
Write PHP and HTML code to display a list of the most recent 5 links from all users, sorted in descending date order – that is, the most recent posts are at the top. This timeline of links should be visible to anybody without logging in.
Create a page which displays the comments for an individual link. This may mean adding a comments button or link to each post in the global timeline.
Write HTML and PHP code to allow logged-in users to comment on links shared by other users. This should create a new entry in the Comment table.
Write HTML and PHP code to allow logged-in users to see all links shared by a particular user. This page should be accessible through a link on the comments page, the global timeline, or both.
From the User view, write PHP and HTML to allow a logged-in user to block the displayed user. This should add an entry to the Block table. If the user is already blocked, allow them to be un-blocked.
Update your global timeline and comments pages to hide links and comments by blocked users when logged in.
Complete the following using SQL aggregation such as COUNT and SUM, subqueries or nested SELECT statements, inner joins and (left or right) outer joins.
Create a page that contains a list of the top 5 most-commented posts from all time, ordered in descending order by number of comments.
For each post in the timeline that has comments, display the number of comments with the post.
Bonus challenge task (optional!) – Comment threading
Extend the data model and write appropriate PHP code to implement a feature that allows comments to be posted in reply to other comments:
Comments should have a reply link or text-box below them, which allows adding a reply;
Comments shown in response to other comments should be visually indented or distinguished from their parent comment;
Counts of comments on the global timeline should include all replies as well as top-level comments; A user should not be able to reply to their own comment
There are no partial marks awarded for this bonus task – you must complete all features to attain the bonus marks.
It is possible to attain full marks for this assignment without completing this challenge task.
Include a written report containing:
Initial data details
The SQL queries you used to test your database
A list of parts of the assignment you have completed or not completed.
Details of specific assistance you received from people other than your lecturer or tutor, and the names of those assisting.
This assignment is supported by the first 5 lectures and the first 6 labs. Work on the assignment should be spread over several weeks after the relevant lab has been mastered.
All files should be zipped and uploaded to Moodle by the due date and time. Check with your tutor as to whether a hard copy is required in addition to the electronic submission.
Refer to the attached marking guide.
Feedback will be supplied through Moodle. Authoritative marks will be published through fdlMarks
Plagiarism is the presentation of the expressed thought or work of another person as though it is one's own without properly acknowledging that person. You must not allow other students to copy your work and must take care to safeguard against this happening. More information about the plagiarism policy and procedure for the university can be found at http://federation.edu.au/students/learning-and-study/online-help-with/plagiarism.
Marking Guide: Assignment 1
Feature Criteria Maximum Obtained
Initial data Requirements satisfied 1
Creating the database Table structure, data types, field lengths, initial data entry 1
User accounts Account sign-up 1
Validation that password meets complexity requirements (at least 5 characters) 1
Log in and Log out 1
Inappropriate password hashing (MD5, SHA1 or plain-text passwords) (-2)
Timeline Most recent 5 links/posts listed in descending order 1
Sharing Links Logged-in users can share links 1
Comments Comments view 1
Logged-in users can comment on links 2
User view Page of all links shared by a user 1
Author of post is a clickable link from timeline/comments page 1
Blocking Block/unblock button on user view 1
Links/comments from blocked users are not visible in global timeline/comments view 2
Aggregate data Top 5 most-commented posts from all time 1
Include comments count in global timeline 1
Bonus optional task Threading Meets specification (reply, indent, counts, no selfreplies) (no partial marks) 2
Documentation Initial data and test queries 2
Completion of tasks, Assistance statement (lose 1 mark each if not included) (-2)
Quality of code Layout, structure, indentation (-1)
Appropriate and consistent naming scheme (-1)
Valid HTML5 (-1)