$template->setVariable("ORDER_TOTAL", sprintf("\$%4.2f\n", $orderTotalPrice)); $template->parseCurrentBlock("items"); $template->setCurrentBlock(); $template->showWinestore(NO_CART, B_HOME); } // ---------- session_start(); // Connect to a authenticated session sessionAuthenticate(S_SHOWCART); // Check the correct parameters have been passed if (!isset($_GET["cust_id"]) || !isset($_GET["order_id"])) { $_SESSION["message"] = "Incorrect parameters to order-step4.php"; header("Location: " . S_SHOWCART); exit; } // Check this customer matches the $cust_id $connection = DB::connect($dsn, true); if (DB::isError($connection)) { trigger_error($connection->getMessage(), E_USER_ERROR); } $cust_id = pearclean($_GET, "cust_id", 5, $connection); $order_id = pearclean($_GET, "order_id", 5, $connection); $real_cust_id = getCust_id($_SESSION["loginUsername"]); if ($cust_id != $real_cust_id) { $_SESSION["message"] = "You can only view your own receipts!"; header("Location: " . S_HOME); exit; } // Show the confirmation HTML page show_HTML_receipt($cust_id, $order_id, $connection);
} // Now, add all the mandatory fields to the output $template->setCurrentBlock(); $template->setVariable("EMAIL", $_SESSION["loginUsername"]); $template->setVariable("FIRSTNAME", $row["firstname"]); $template->setVariable("SURNAME", $row["surname"]); $template->setVariable("INITIAL", $row["initial"]); $template->setVariable("ADDRESS", $row["address"]); $template->setVariable("CITY", $row["city"]); $template->setVariable("STATE", $row["state"]); $template->setVariable("ZIPCODE", $row["zipcode"]); $template->setVariable("DOB", $row["birth_date"]); $template->setVariable("CUSTTITLE", showTitle($row["title_id"], $connection)); $template->setVariable("COUNTRY", showCountry($row["country_id"], $connection)); } // ----- session_start(); $connection = DB::connect($dsn, true); if (DB::isError($connection)) { trigger_error($connection->getMessage(), E_USER_ERROR); } // Check the user is properly logged in sessionAuthenticate(S_MAIN); // Find out the cust_id of the user $cust_id = getCust_id($_SESSION["loginUsername"]); // Start a new page $template = new winestoreTemplate(T_CUSTRECEIPT); // Show the customer confirmation show_HTML_receipt($cust_id, $connection, $template); // Add buttons and messages, and show the page $template->showWinestore(NO_CART, B_HOME);