Assignment

Updated on 28 Dec 2018

COMP306 Software Design and Development - Assignment

This assignment has been designed to be done individually. However that doesn’t preclude you from collaborating or submitting a group assignment if you so wish. Code, table structures and data (as SQL statements from the phpMyAdmin export tool) must be submitted on CD.

This assignment constitutes 20% of your overall assessment.

You will be required to complete several tasks, and as such your code must be clearly identified for each task.

Assignment is due Friday ##/##/####, 3:30pm. Make sure you submit your work with an assignment coversheet.

Background Information

You will be constructing a website with varying levels of functionality and complexity. You are expected to complete any 3 of the 14 programming tasks listed. Section B has one item, the Design Review. There are 3 programming tasks and one Review assessment required for this assignment.

Students submitting the assignment as group work will be graded as a group for tasks in Section A. Section B is graded individually.

Each task carries equal weighting. The tasks are designed to extend and challenge your skills, and you should feel a sense of satisfaction and achievement once finished. The tasks also resemble real life scenarios that you may be asked to build into a website one day.

Instructions

  • Complete three tasks from Section A.
  • Make an appointment with the lecturer for the Design Review in Section B.

Section A – Complete any THREE tasks

TASK 1:

Provide a login mechanism for your website so that only those users that have logged in can view the website. Provide a username test and password test123 for the site. Usernames and Passwords must be stored on a MySQL database, and the password should be encrypted.

TASK 2:

Provide a webpage so that an administrator can enter news items. The administrator will need to be able to enter a title and body of the news item. When the news is displayed only the latest 2 news items are displayed on the main page, and the remainder are displayed on an ‘Older News’ page. The news should be displayed in a format similar to that shown below.

This is our assignment – 20th Sep 2010

Our assignment was handed out to us today, and it looks really hard. I knew I should have paid attention in class, and with the design review at the end, I know I wont be able to cheat!

TASK 3:

Continuing on from the Task 2, provide a mechanism so that news items a user has not seen is marked as being new.

TASK 4:

Continuing on from task 2, provide a link for each news item called ‘view comments’. When the link is clicked the user is taken to a new page where a list of comments for that news item is displayed (it would also be appropriate to display the news item that the comments relate to on this page as well). Also provide for the ability for the user to add their own comments.

TASK 5:

Develop a ‘random quote’ generator for the site. The quotes are to be stored in a text file (populate the file with at least 4 quotes) and your code is to randomly select a quote from the text file and display it on the webpage. (HINT: The filesystem functions will be very useful for this task)

TASK 6:

Create a new sub directory on the server and populate it with at least 4 zip files. Create a webpage that displays a list of any files in that directory (using the filesystem and directory functions to find the files in the directory).

TASK 7:

Continuing on from Task 6, provide a ‘view’ link for each zip file so that when the user clicks on the link, the contents (filenames) of that zip file are displayed.

TASK 8:

Below is some code for your website. Incorporate this code into your homepage, and complete the get_due_date function. The specifications of the get_due_date function is that it returns the date 10 days from now. However if the due date falls on a Saturday or Sunday, the due date is extended to the following Monday.

$due_date = get_due_date();
echo "<p>If you borrow any items, it will need to be returned by $due_date</p>";

TASK 9:

For the user logon screen from Task 1, provide a ‘forgot password’ link. The link opens a new page where the user is prompted to answer a secret question. The question and answer are stored against the user on the MySQL database. If the user answers correctly, the password is reset to a random sequence of 8 characters, and an email sent to the user informing them of their new password.

Alternatively, provide a reset password link that when clicked will send an email to the user informing them of a password change request and to click the following link to confirm. When the user clicks on the link sent in the email, the password is reset and the user is informed of their new password.

TASK 10:

Below is some code for your website. Incorporate this code in your homepage, and complete the get_mail function. The specification of the get_mail function is that it returns the number of unread email messages in your mailbox.
(HINT: The IMAP section in the php.net documentation section will be very helpful. Also you will need to see the lecturer if you are planning to do this task.)

$msg_num = get_mail(); 
echo "<p>There are $msg_num unread messages in your inbox</p>";

TASK 11:

This task is done separately from your website code. Shown below is a sample piece of data that has been extracted from an old database system and needs to be migrated to MySQL. Unfortunately the date column is not in a format that is recognized by MySQL (i.e. first row the date field contains 4/01/2002).

1~2~2~7412~4/01/2002~141.45~2
2~2~3~2431~21/01/2002~123.83~3
3~2~4~62099~6/2/2002~41.77~4

Write a script that can load a file containing the sample data and convert the date values into the format of YYYYMMDD. The new data should be written to a new text file, and the contents from above would be converted into the format shown below.

1~2~2~7412~20020104~141.45~2
2~2~3~2431~20020121~123.83~3
3~2~4~62099~20020206~41.77~4

(HINT: The file function would be useful for loading the data from the text file, and the string functions / regular expressions would be helpful in manipulating the data).

TASK 12:

Provide a mechanism so that a user can upload images to your webpage. Allow the user to enter a description for the photo. When other people few your page they should see the uploaded images and the corresponding description for that or photo. (HINT: Be sensible with the image sizes)

TASK 13:

Continuing on from Task 12, provide a mechanism so that a user can click on a button (or link) and all uploaded images are compressed into a single zip file.

TASK 14:

Continuing on from Task 6, provide a download link for each zip file so that the file can be downloaded. OR continuing on from Task 13, once the zip file has been created, have it download to the user’s PC automatically.

The following code will be very useful.

$the_file = $_GET['file_requested'];
$fs = filesize($the_file);

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename=' . $the_file);
header("Content-Length: $fs");

readfile($the_file);

Section B – Make appointment with Lecturer.

Design Review. You will need to make an appointment with the lecturer for week 12 (or later) when your work has been completed. This task will require you to explain the code you’ve written and is designed so that you can demonstrate your understanding of PHP and MySQL (and also of what you’re submitting).

References – Ensure that your code is properly referenced.

Some students may find it easier to complete their assignment by ‘borrowing’ code from other members of the class or from the internet. In these cases (or any case where the code is not your own), you must clearly indicate this in your source file. Exercise or sample code from the lecture notes, tutorials or the textbook does not need to be referenced.

Part of the assessment criteria for the assignment is ‘authenticity of code samples’. Students that borrow code can not expect to get full marks, however they are awarded marks in accordance with the other assessment criteria and implementing a solution. Students that steal, plagiarise or hand in work that is not pre-dominantly their own will probably not get any marks as they would fail to meet a number of other assessment criteria.

Failure to acknowledge the source of your code that is not your own will be considered plagiarism, and can result in penalties.