diff_months: 2

Web Development COMP2101

Flat 50% Off Order New Solution
Added on: 2025-05-05 05:27:57
Order Code: LD526728
Question Task Id: 0
  • Subject Code :

    COMP2101

Assessment 3 Web development Marking guide

Assessment criteria / grading rubric

CRITERIA

A: Excellent

(>80%)

B: Very good

(7079%)

C: Good

(6069%)

D: Acceptable

(5059%)

N: Unacceptable

(<50>

Create a navigation bar to link pages

(10 marks)

Create a navigation bar with links pointing to at least 6 webpages

(810 marks)

Create a navigation bar with links pointing to 45 webpages

(7 marks)

Create a navigation bar with links pointing to 23 webpages

(6 marks)

Create a navigation bar with links pointing to 1 webpage

(5 marks)

No navigation bar

(<5>

Implement functionalities of the website

(70 marks)

Implement at least 12 functionalities

(5670 marks)

Implement at least 911 functionalities

(4955 marks)

Implement at least 68 functionalities

(4248 marks)

Implement 35 functionalities

(3541 marks)

Implement less than 3 functionalities

(<35>

Design the layout and styling of the website

(20 marks)

Very good use of spacing, symmetry, font and colours

Consistent page layout

(1620 marks)

Good use of spacing, symmetry, font and colours

Consistent page layout

(1415 marks)

Appropriate use of spacing, symmetry, font and colours

Consistent page layout

(1213 marks)

Appropriate use spacing, symmetry, font and colours

Inconsistent page layout

(1011 marks)

Improper spacing, symmetry, font and colours

Inconsistent page layout

(<10>

IFU Web Assignment - Appendix

Relative URLs

A relative URL is a URL that is determined based on the path of the current page. Examples of a relative URL:

View Cart

Examples of an absolute URL This type of URL is NOT allowed on this assignment.

'http://webprog.cs.latrobe.edu.au/12345678/IIT/Lab08/ViewCart.php'>View Cart

View Cart

That last one is not even a valid URL

A URL that starts with a slash is called a root relative URL. This type of URL is NOT allowed on this assignment.

View Cart

NOTE: you are allowed to use an absolute URL if you are linking to the brands website.

The reason this is so important is because we will not be marking your assignment from your home directory, instead we run the assignments from a special UNIX account.

Remember that Windows is not cases sensitive, but UNIX is. Please ensure your URLs are the correct case. This may cause problems if you develop your website on Windows and then copy it to UNIX.

Old HTML tags

There are a number of HTML tags and attributes that have been deprecated, which means your website must not use them because they are outdated and have been replaced by CSS.

You can always check if the tag or attribute you want to use is outdated by checking the w3schools website. List of deprecated tags and attributes:

http://www.tutorialspoint.com/html/html_deprecated_tags.htm

Here is a list of new tags in HTML5http://www.w3schools.com/htmL/html5_new_elements.asp

CSS Tricks

Animations.

You can do animations entirely using CSS3.http://www.w3schools.com/css/css3_animations.asp

Take a look at this:http://jsfiddle.net/nys5qzkd/5/

Imagine if we had something like this on the homepage, but instead of photos we had products that the user could click on. It would look very nice on your webprog.

Note: because CSS animations are so new, some browsers need to have special browser specific CSS. Most browsers will accept animation and @keyframes

But Chrome, Safari and Opera need to have -webkit-animation and @-webkit-keyframes

You should also investigateCSS Transitions.

Box sizing

When you specify a width in CSS, it does not include the margins and borders.

So a div with a width of 200px and a margin of 10px ends up taking 220px of space. This can cause all kinds of issues when using percentages.

To solve this issue you can use thebox-sizingCSS property.

Other Notes

If you're concerned that other students may try to copy your assignment (remember that your site is open to the public internet) what you can do is place an empty file named index.html in your public_webprog/IIT/ directory

Then rename you Lab08 directory to something that only you know. So now the only way to access your assignment is if you know the URL.

Detecting if the user already has a product in their cart. [NEW!]

Some of you may have noticed then when the user clicks on the 'Add To Cart' button nothing happens. But something is happening, it's just too fast to see!

When you click the 'Add To Cart' button the user gets redirected to AddToCart.php which adds the product to the ShoppingCart cookie. AddToCart.php then redirects the user back to ViewProduct.php instantly.

This happens so fast that it appears that nothing happened, so we need to provide the user some feedback! What we can do is make it so that the 'Add To Cart' button disappears if the product is already in the users cart.

This also prevents the same product being added multiple times by mistake (people might double click the button) There is a few ways to do this but this might be a good opportunity to use a user defined function.

Let's create a function called Does Cart Contain Product() which takes one parameter: the Product ID to look for. Our function will return true if the cart contains the specified product and false if it does not.

Step 1

Open functions.php and add a new function definition to the bottom of the file like so:

{

}

Notice that our function takes one variable as the input, this is known as the parameter (or argument)

Step 2

Inside out function we need to check if the user even has a shopping cart. If the user does not have a shopping cart, return false.

Inside our new function place this code:

if(isset($_COOKIE['ShoppingCart']))

{

cart

}

else

{

//user has no shopping cart.

}

Step 3

Ok so now we need to see if the users shopping cart contains the ProductID.

I have provided a handy function called stringContains(), which takes two parameters: a $haystack and a $needle. stringContains() will return true if it finds the needle in the haystack and returns false is it cannot be found.

We can use this function because the shopping cart cookie is a string! Inside the IF statement from step 2 (where the TODO is) place this code:

i

{

}

else

{

}

Step 4

Congratulations you have implemented you first PHP function!

Now we need to put it to good use. Open your ViewProduct.php and place this code inside the file.

// if the user has this item in their shopping cart

if(DoesCartContainProduct($ProductID))

{

}

else

{

echo "<form action = 'AddToCart.php?ProductID=$ProductID' method = 'POST'>";

//TODO echo the submit button here.

}

Common Errors

This happens if you include functions.php twice in the same file.

To fix this just remove the lower include.

Here we try to output $y before it was given a value.

PHP reads the file from top to bottom, so we need to make sure that $y has a value before we try to readthevalue. To fix this rearrange the file to define it before it gets used. Likeso:

This happens if you are selecting a column that is not part of that table.

Session ID is not in the movies table, we may need to do a join to the sessions table if we want to get sessionIDs

This can happen if you have a stray comma before the word FROM in your SQL. Can also happened if you have unclosed brackets just before the word FROM.

This usually happens because we never selected the plot in our SQL.

Remember that you can always check what is in a variable using var_dump()This can also occur if you did not put commas between your column names.Another possibility is this:

Notice that we are using $row2 instead of $row.

Make sure the $row variables names are correct.

Syntax errors can also be caused by having your keywords in the wrong order. LIMIT statements must goafterINNER JOIN statements. See the SQL lecture slides.

This often happens if you have the wrong quotes (or no quotes) around strings.

When in PHP try to get all strings to appear grey like so:

See the assignment appendix

This happens if you have a bindValue() with no matching question mark in the SQL. or if you have more bindValue statements than you do question marks.

Check that every question mark has a corresponding bindValue() with the correct number.

This happens when you try to bind a text variable to a number

Offsets must be integers. "Cheese" is not a number, so having an offset of "Cheese" makes nosense.

Check that your bindValue statements are correct.

This can happen if you are missing a closing curly bracket on your if statements. Check that every opening bracket "{" has a corresponding closing bracket "}"

This happens if you did not set proper permissions to the database directory AND the database files.

My reviews are displaying strange but I have no error messages.

This is usually caused by malformed HTML (forgetting to close tags) Run the page through the validator (see end of Lab 7)

IFU Web Assignment File Details.

This file describes the details of the PHP files that your online shop system will use.

You have also been provided with a diagram showing how the user will be directed around the different pages.

The red arrows represent POST requests and blue arrows represent GET requests. The files marked in green will be visible on the navigation bar.

The files marked in orange are special technical files that the user never sees.These files do not contain any HTML. Instead they perform a special task and depending in that task they redirect the user to another page.

Orange files should always be accessed by POST requests only because they modify the state of the website. The files marked in blue will be accessed using GET requests, and also require URL parameters.

The blue and green files should have the navigation bar visible at all times.

Unless there is a system error.

I recommend completing the orange files last.

If you have not already done so, please login to phpLiteAdmin and have a look at the data in all the tables this will help you get a better idea of what data you have to work with.

Message Cookies

Sometimes we want to display a message to the user but we dont want to display it on the current page.

Let's consider EmptyCart.php, this file has one task, empty the users shopping cart (deleting a cookie) When EmptyCart.php has completed its task with no errors it will redirect the user back to ViewCart.php

But we should always provide the user some feedback saying that the operation was successful. So we should display a message like "Your cart has been emptied"

The issue here is if we just echo a message on the page and then redirect the user, the user will have no time to read the message!

What we really need to do is display the message on ViewCart.php.

Problem: How can EmptyCart.php display a message on ViewCart.php?

Solution: Cookies.

What EmptyCart.php can do is set a cookie that contains the message we want to display, then redirect the user to ViewCart.php.

ViewCart.php then looks to see if there is a message cookie and if so display it on the page then deletes the cookie.

In this situation we would consider EmptyCart.php to be the message sender and ViewCart.php to be the message receiver.

There are a number of pages that use Message Cookies,these have already been implemented for you. Using the functions getCookieMessage() and setCookieMessage() (located in functions.php).

You must style the cookie messages so that they are noticed by the user (Error messages should be red for example) Although not all the cookie message are errors so make sure you style them appropriately.

I would recommend using a

or

for this, and maybe have a CSS class called errorMessage or something.

NOTE: getCookieMessage() will return an empty string if there was no messages. getCookieMessage() will also perform htmlspecialchars() on the messages so you can safely echo it to the page.

ProductList.php

Allows a customer to browse the items that our website has for sale.

This page will also provide a search functionality that allows potential customers to search the database for products they are interested in.

The output is limited to 10 items per page. The user should have a hyperlink to get to the next page and a hyperlink to get to the previous page.

The products should be sorted by popularity (that is, how many orders does each product appear in).

SQL Statements Required:

  1. One SQL SELECT statement to select the relevant

ViewProduct.php

Shows the details of a given product including a picture, description and price. The ProductID will be provided by a URL parameter.

Also shows the details of the brand, including a brand logo and a hyperlink to the brands website.

This page will also provide a button that says 'Add to Cart'. When the user clicks this button they will be taken to AddToCart.php which will then add the product to the users shopping cart. AddToCart.php will then send them back to this page.

Check to see if the user has this product in their shopping cart, if so dont display the 'Add to Cart' button.

SQL Statements Required:

  1. One SQL SELECT statement to select the given product.

CustomerList.php

Allows the business owners to view all the customers in the database.

For every customer in the database list ALL their details including CustomerID, name, address etc. This data should be displayed using a

This file was not provided to you, you must make it yourself.

SQL Statements Required:

  1. A SELECT statement to select all the Customer details in the database.

OrderList.php

Allows the business owners to view all the orders in the database and the customer who placed the order.

This must include the details of the order (OrderID and Time placed) and ALL the details of the customer who placed the order.

The OrderID should function as a hyperlink to ViewOrderDetails.php This file was not provided to you, you must make it yourself.

SQL Statements Required:

  1. A SELECT statement to select all the Order and Customer details for all Orders in the database.

ViewOrderDetails.php

This file is like a receipt, it shows the details of a given order and details about the customer who placed it. Users will be sent to this page when they complete an order.

The OrderID will be provided by a URL parameter.

This page must include the details of the order (OrderID and Time placed) and the details of the customer who placed the order.

Also must display the details of each product that was in the order (description, brand, price, quantity ordered etc.). There can be multiple products in one order.

The product picture should function as a hyperlink to ViewProduct.php

Dont forget to have an image of the product and brand for each product in the order.

This page should also show the total price of the order (make sure you factor in Quantity)

SQL Statements Required:

  1. A SELECT statement to select all the information about a particular Order including information about the customer who placed the
  2. A SELECT statement to select the details of the products in the given

ViewCart.php

Allows the user to view the items in the shopping cart (a cookie).

Must also display the product and brand details for each product in the cart including pictures of both the brand and product.

This page must also calculate the total cost of the items in the cart.

Please note that this page will have two separate <form> tags each with its own submit button, one to confirm the order and one to empty the shopping cart.

NOTE: that both of these <form>s should only appear if the user has items in the shopping cart.

If the user clicks the "Confirm Order" button the user will be sent to ProcessOrder.php with some POST data. If the user clicks the "Empty Cart" button the user will be sent to EmptyCart.php with some POST data.

SQL Statements Required:

  1. A SELECT statement to select the details of the products in the users shopping cart

ProcessOrder.php

This file will process the customer's order (add it into the database) and will never be seen by a customer.

If the order is a success we will redirect the user to ViewOrder.php and say that the order was a success using a cookie message.

If the order fails (bad username provided) we will redirect them back to ViewCart.php and display an error message using a cookie message.

You can assume that the user will only be buying one of each item (Quantity is always 1) If there were no items in the cart, echo a system error.

SQL Statements Required:

  1. A SELECT statement to select the CustomerID of a given
  2. An INSERT INTO statement to add a new Order to the Order
  3. An INSERT INTO statement to add the products in the cart to the OrderProducts

EmptyCart.php

This file will empty a user's shopping cart (deleting the shopping cart cookie)

Then redirect the user back to ViewCart.php with a message saying that the cart has been emptied.

This page will be accessed by a POST request from ViewCart.php.

This POST request will contain the name of the button that the user clicked on "EmptyCartButton" the shopping cart should only be deleted if this variable has been set.

SQL Statements Required:

[None]

AddToCart.php

When the user wants to add an item to the shopping cart they will be sent to this file from ViewProduct.php

This file will add the item to the users shopping cart and redirect them back to ViewProduct.php. This file all also give the user a cookie that contains the shopping cart info.

This file will not be visible to the user, they will be instantly redirected back to ViewProduct.php.

SQL Statements Required:

[None]

SignUp.php

This page will allow new users to register to the website so that they can purchase products.

This file will need to have input text fields so that a user can sign up to the shop. Including: UserName, FirstName, Last Name, Address, and City.

All of which are required.

When the user clicks submit they will be taken to AddNewCustomer.php AddNewCustomer.php may send the user back to this page if the username was not available. This page must display any message cookies.

SQL Statements Required:

[None]

AddNewCusomer.php

This file will not be visible to the user.

When the user clicks the submit button on SignUp.php they will be sent to this page with some POST data.

This page needs to process the data and store it into the database, then if successful send the user to the homepage with a welcome message cookie.

Usernames should be unique so we need to check to see if the chosen username is available.

If the customer's chosen username was taken by someone else redirect the user back to SignUp.php with a message cookie saying that the user name was not available.

If the username IS available insert the customer into the database and redirect them to the homepage with a message that says that the registration was a success.

You should also use the trim() function on the input data to remove any whitespace from the start/end of the string.

SQL Statements Required:

  • SQL SELECT statement to check if the username is
  • SQL INSERT INTO statement to add the new customer to the customers

Homepage.php

This file is the main starting point for users who visit your website.

I will leave it up to you on what things should go on this page. But you must not leave it blank. Suggestion: an animation might be a good idea.

The only requirement is that it should have a text box near the top so that users can search.

When the user clicks submit they should be taken to ProductList.php with the appropriate search string. This page needs to display any message cookies (form AddNewCustomer.php)

You may rename this file to index.php if you choose.

  • Uploaded By : Nivesh
  • Posted on : May 05th, 2025
  • Downloads : 0
  • Views : 53

Order New Solution

Can't find what you're looking for?

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more