include_once "Brain/field_const.php"; include_once "Brain/User.php"; include "header1.php"; ?> <link href="css/register.css" rel="stylesheet" type="text/css" /> <script src='js/register.js'> </script> <?php include "Brain/District.php"; include "Brain/UserControl.php"; include "header2.php"; include_once "Brain/ShoppingCart.php"; $cart = new SCart(); if (isset($_GET["error"])) { echo "<script> alert('Sorry, we only delivery two day after order.')</script>"; } if (UserControl::checkState() && UserControl::getType() == 'c') { $cust = getCustomer(getInfo(UserControl::getUserNo())[ID]); if (isset($_POST[distNo], $_POST[custAddr], $_POST["sdate"])) { $date = strtotime($_POST["sdate"]); $minday = strtotime(date("Y-m-d", strtotime("+ 2 days"))); if ($date < $minday) { header("Location: checkout.php?error=true"); } else { if ($cart->checkout($_POST["sdate"], "100", $_POST[custAddr], $cust[custNo], $_POST[distNo])) { header("Location: shoppingcart.php?sucess=true"); } else { echo "<script> alert('Sorry!');</script>"; } } } $district = getAllDistricts();
<?php error_reporting(0); include_once "../Brain/field_const.php"; include_once "../Brain/functions.php"; include_once "../Brain/ShoppingCart.php"; include_once "../Brain/Product.php"; include_once "../Brain/UserControl.php"; if (!UserControl::checkState()) { echo "Error: You must login first!"; return; } regGet('act', 'prodNo', 'qty'); if (!isset($act) || !isset($prodNo)) { echo "Error: No action specified"; return; } $cart = new SCart(); $prod = getProduct($prodNo); //$cart->clear(); if ($act == 'add') { if (!isset($qty)) { $qty = 1; } $cart->addProduct($prodNo, $prod[prodPrice], $qty); //if not success //... } else { $cart->removeItem($prodNo); } $cartProds = $cart->getProducts();