COSC2413 / Semester 2, 2020
Assignment 2 (Server-side programming)
Note: in order to proceed to higher parts, you must attempt or make a reasonable attempt on all of the specifications in
the lower part, you must not cherry pick specifications from various parts. As an example, make a reasonable attempt on
all of specifications in PA part before proceeding to CR part and so on.
PA part [20 marks]
a. (3 marks) Add a sitemap to the website. You must use a jQuery plugin to add this sitemap.
b. (2 marks) Remove the HTML5 validation from Contact us form and use jQuery validation plugin to perform the
validation: all fields must be necessary, email must in proper format.
c. (10 marks) Registration form from assignment 1 now requires major changes. Please read the following
carefully and implement the following workflow:
• Remove all the client-side validation code from assignment 1 and perform all the validations (this
means all the validations mentioned in assignment 1 for this form) on server-side via PHP.
• Add an additional field Password in the registration form and create a regular expression to validate
password field. The password must
o start with a capital alphabet,
o must have at least 6 characters ,
o one of these characters must be either !, ^, & and
o must end with a number.
• Upon successful server-side validation, all the form data must be stored inside a JSON file
(users.json). The file must be stored one level inside a2/data directory.
• A welcome message must be shown showing the success of registration page and asking the user to
d. (4 marks) Add a separate login page OR login form in the header that allows all registered users to log in. The
form will check for the validity of user credentials against the data stored in users.json file. User
credentials are as follows:
Username == email in registration form, Password = password field in registration form
Upon successful validation and login, the following workflow must be implemented:
• user will land on a brand-new page i.e. myFitness page. This page is only accessible to logged in users.
The page must greet user with Welcome message.
• myFitness page link will appear in sitemap as well- but if a non-logged in user clicks on this link, they
must be asked to log in.
Optional implementation: upon successful registration, user may be auto logged in and redirected to
e. (1 mark) Implement a logout link on myFitness page.
Page 4 of 7
CR part [8 marks]
f. (8 marks) You are to create a myFitness page for the logged in user. This will be a fully responsive PHP page.
The responsive design must be implemented using Bootstrap. This page is like a logbook of exercises for a
Step 1: User will be able to choose from any of the following categories of exercises:
Note: the above icons are just a suggestion, you may choose an image of your own liking. You must offer a
minimum of three categories to the user. This means you only need three categories, as stated, above icons
are a suggestion only.
Clicking on any of the above icon will offer the user a place to input the amount of exercise done, as an
example: if user chooses ‘walking the dog’, they should be able to put the amount walked and for how long, so
on and so forth.
Step 2: User will then be asked to put in their vital statistics i.e., weight, age and BMI.
Step 3: Weekly goal (i.e. how much would the user like to walk or exercise)
Step 4: All of the above information must be stored inside a separate file (user_stats.json). This file
must be inside a2/ directory. You must store user stats along with their username.
Step 5: Finally, the user information may be displayed as follows:
Note: the above screenshots are just a suggestion, you may choose to depict information differently
Page 5 of 7
DI part [4 marks]
g. (4 marks) Add an AJAX enabled search feature on the myFitness page, a screenshot has been suggested below:
The search would work on both partial and full texts. It should be case insensitive.
As an example, if user adds M and presses Enter key, it should display Motorcycle riding and Mowing the lawn.
If user types in Walking, search should return Walking and Walking the dog.
Note: for the following (HD section), you will need to perform independent research to think critically. If you have any
questions re the specifications, please ask questions via Assignment 2 discussion board.
Page 6 of 7
HD part [8 marks]
h. (3 marks) You will need to devise an algorithm/code to customise exercise recommendation for the user.
Based upon the exercise undertaken by user and weekly activity level, a weekly exercise routine will be
generated for them.
As an example, if the user has already done a lot of walking, the recommendation could be to do less
cardio but more of weight training, so on and so forth
This routine will comprise of cardio and weight exercises along with associated video(s).
The routine must be displayed in a visually appealing UI (user interface) along with associated media elements.
You are encouraged to complete this part with PHP for the programming part and Bootstrap for the visual
i. (2 marks) Display the Melbourne weather information in the header section of the home page. This information
should be fetched via REST call made to a weather API. Based upon the weather, a motivational health related
quote must be displayed. This is to motivate the user.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx