COS60007 Creating Web Applications and Databases

Click here to order this assignment @Essaywriting.us.No Plagiarism.Written from scratch by professional writers.

Swinburne University of Technology
Faculty of Science, Engineering and Technology

COS60007 Creating Web Applications and Databases

Assignment 2
PHP + MySQL
Due Date
10am on Monday in Week 12
(Late submission penalty: 10% per day)
Submission Method
ESP (https://esp.swin.edu.au/)
Mercury Server (mercury.swin.edu.au)
Assessment Date
Demonstration in Your Tutorial in Week 12
(No detailed feedback will be provided to students who failed to
demonstrate their assignments in the tutorial.)
Contribution to Final
Assessment 10%

1. Purpose
In this assignment you will extend the website you developed in assignment 1. You will create
server-side PHP scripts to process and store the quiz data sent from the form on quiz.html. It
will involve the creation of simple MySQL tables to store and update information retrieved from
your website.
In addition, you will create a webpage that allows a quiz supervisor to view, update and delete
quiz attempts.
There will also be an opportunity to enhance your website beyond the above basic requirements.
2. Basic Requirements (80%)
[IMPORTANT] Use only mysqli commands in this assignment.
1.1 Use PHP to reuse common elements in your website
PHP provides us with techniques to modularise and reuse our web application code. You need to
refactor your web pages so that common static HTML elements such a menu, header and footer are
written in common text files which are then included into your webpages.
[IMPORTANT] Name the include file(s) with an .inc extension and but don’t forget to rename
your main pages with a .php extension.
1.2 Create a Quiz Attempts Table
Create a table attempts in your MySQL database. The information in each attempt record should
include the following fields with appropriate data types:
COS60007 Creating Web Applications and Databases – Assignment 2 Page 2 of 4
• attempt id (auto-generated primary key)
• date and time of the attempt (generated by PHP)
• first name
• last name
• student number
• the number of the attempt (1 -3)
• score for the attempt
When a user submits a quiz attempt to the website, if an attempts table does not already exist in
your database it should be programmatically created by your code.
1.3 Marking the Quiz (markquiz.php)
Adapt the quiz form (quiz.html) you developed in assignment 1 to add quiz attempt records to
the attempts table. This form should submit the data to a php webpage called markquiz.php.
This php webpage will calculate the number of correct answers in user’s attempt and save it in the
corresponding record in attempts table.
1.4 Quiz Supervisor Webpage (manage.php)
Create a webpage with a link on the menu that allows a supervisor to make the following queries of
the attempts table:
• list all attempts.
• list all attempts for a particular student (given a student id OR name).
• list all students (id, first and last name) who got 100% on their first attempt.
• list all students (id, first and last name) got less than 50% on their third attempt.
• delete all attempts for a particular student (given a student id).
• change the score for a quiz attempt (given a student id).
Create appropriately named html/php pages to implement access to the quiz supervisor page and its
queries.
3. Enhancements (20%)
Marks will be allocated to enhancements of your choice that go beyond the basic requirements. In
this assignment, we will consider only PHP and MySQL enhancements. You are encouraged to be
creative in thinking up possible enhancements.
Examples of PHP / MySQL enhancements you might make that will contribute a higher mark include:
• Store quiz questions in a database table and have the HTML dynamically created by PHP. Use
this table to also store correct answers so responses can be marked without hard-coding.
• Normalise the structure of the data tables by, for example, creating separate student and
attempt tables. Creating a primary-foreign key link between these tables.
• Create a table that stores unique user-ids and passwords for quiz supervisors. Access to the
supervisor web page should only be granted if a correct user name and password are entered.
• Provide more secure access to the supervisor page. Have access to the website disabled for
user a period of time on, say, three or more invalid login attempts. Create a log out page with
a link from the manage web page. Ensure the supervisor’s webpage cannot be entered
directly using a URL after logging out.
• Provide the quiz supervisor with the ability to select the field on which to sort the order in
which the quiz attempt records are displayed.
COS60007 Creating Web Applications and Databases – Assignment 2 Page 3 of 4
• One or more enhancements of your own devising. If you plan such enhancements it would be
worthwhile checking with your tutor first to ensure they are appropriate and non-trivial.
You must have an enhancements.html or enhancements.php page that lists the
enhancements you have implemented. For each enhancement, include:
• a brief description.
• a hyperlink to where the enhancement is implemented.
A maximum of 2 extensions will be assessed. Up to 10 marks will be given per enhancement type.
The number of marks you receive for a CSS animation will be at the sole discretion of your
tutor/marker. High mars will not be given for trivial enhancements.
[IMPORTANT] Any enhancements that are not listed on the PHP enhancements page will not be
assessed.
4. Website Folder Structure and Deployment Requirements
Create a website structured as specified in assignment 1.
[IMPORTANT] All links to your files should be relative. Do not use absolute links, as these links will
probably be broken when files are transferred for marking. No marks will be allocated if links are broken.
5. Assignment Submission
An electronic copy of your assignment should be submitted through ESP on or before the deadline.
Another identical electronic copy of your assignment must also be uploaded onto the mercury
server.
• Make sure all your files are in the correct folders and compress your root folder with all your
sub-folders with HTML, CSS, PHP and image files into a zip file named “assign2.zip”. Submit
this to ESP. When the zip file is decompressed, the entire website should be able to be run
from index.html without needing to move any files.
• You can submit through ESP for a maximum of 5 times. Old submission will be overridden.
• Note that all deliverables must be submitted as softcopy. There is no need to submit an
assignment cover sheet as ESP generates a receipt upon successful submission.
6. Demonstration Procedure
Your tutor will download your submission from ESP, examine how the website works and looks and
how it is written.
1. Make sure you attend your allocated tutorial. You will demonstrate your assignment to the tutor
in your allocated Tutorial in Week 12.
2. You will demonstrate how you have implemented the website according to the items listed on
the mark sheet.
3. Your tutor will not mark your assignment in the tutorial. Final results are to be released later via
email from ESP.
COS60007 Creating Web Applications and Databases – Assignment 2 Page 4 of 4
Mark Sheet
Basic Requirements
Menus and other common elements imported from include file 
attempts table
– schema can store the necessary information with appropriate data types 
markquiz.php
– text data inputs sanitised 
– score correctly calculated 
– table automatically created if does not exist when accessed 
– attempt correctly added to table 
– on successful submission of quiz, page displays with required information including conditional retry
hyperlink 
– page returned to the user with appropriate error information on unsuccessful submission (e.g., an answer
was not completed, etc.) 
manage.php
• HTML page and table well presented 
• list all attempts for a student given id  or name 
• list all students (id, first and last name) with:
– 100% correctness on their first attempt 
– less than 50% correctness on their first attempt 
• delete all attempts of a particular student (given student id) 
• change the score for a quiz attempt (given id) 
Enhancements
Enhancement Properly
Implemented
Properly
Described Linked to Implementation on Website
1   
2   
Other
Requirement Not Fulfilled
– Fully validated HTML5 
– Appropriate meta-data 
– Adequate comments 
– Uses only mysqli commands 
– Directory Structure as specified 
– Only relative links used 
… other requirements not specified 