Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve for 1, 2, and 3 on the comments. index html file authenticate php file cart php file Cart Contents: Add to your cart: Dog

Solve for 1, 2, and 3 on the comments.

index html file

authenticate php file

// 2. authtenticate the user's credentials: valid users provide the password: "foo" $valid = true; // replace this hard-coded value with true or false based on rule above

if ($valid) { // 3. put the authenticated user's name into the SESSION for later use header("Location: cart.php"); } else { header("Location: index.html"); } ?>

cart php file

// get the cart out of the SESSION (if the cart is not in the SESSION, create it) if (isset($_SESSION['cart'])) { $cart = $_SESSION['cart']; } else { $cart = array(); } // add the new item to the cart $cart[] = $_REQUEST['item'];

// put the cart back into the session (adding a new item may have resulted in a new object in memory) $_SESSION['cart'] = $cart; ?>

Cart Contents:


"; // 6. loop through the cart array and show each entry as a list item using the HTML li tag echo ""; ?>

Add to your cart:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Use a three-step process to develop effective business messages.

Answered: 1 week ago