Example #1
0
include 'functions/productFunctions.php';
$itemID = $_GET['itemID'];
if (!isset($_GET['itemID'])) {
    header("Location:sheetMusic.php");
}
if (preg_match('/^[0-9]{1,3}$/', $itemID) == 0) {
    header("Location:sheetMusic.php");
}
if ($_REQUEST['action'] == 'addToBask' && $_REQUEST['hQuantity'] >= 1) {
    //get stored data in hidden fields
    $iid = $_REQUEST['hItemId'];
    $quantity = $_REQUEST['hQuantity'];
    $getPrice = getItemDetails($iid);
    $price = $getPrice['price'];
    $discount = $getPrice['discount'];
    addToBask($iid, $quantity, 0, $price, $discount);
    //pass this data into addToBask function
} else {
    if ($_REQUEST['action'] == 'addToWish' && $_REQUEST['hQuantity'] >= 1) {
        $iid = $_REQUEST['hItemId'];
        $userId = $_SESSION['UserSession'][0]['userId'];
        $quantity = $_REQUEST['hQuantity'];
        if (isset($_SESSION["UserSession"])) {
            // if not signed in then you get an error..
            addToWish($userId, $iid, $quantity);
            header("Location:wishlist.php");
        } else {
            header("Location:signin.php?notLogged=2&r=wL");
            // ..here
        }
    }
Example #2
0
$basket = $_GET['bask'];
$id = $_SESSION['UserSession'][0]['userId'];
if ($remove == 1) {
    removeWishlistItem($itemId);
}
// remove one item
if ($remove == 2) {
    removeAllWishlist($id);
}
// remove all items
if ($basket == 1) {
    $flag = 1;
    $getPrice = getItemDetails($itemId);
    $price = $getPrice['price'];
    $discount = $getPrice['discount'];
    addToBask($itemId, $quantity, $flag, $price, $discount);
    removeWishlistItem($itemId);
}
if ($update == 1) {
    preg_match('/^[0-9]{1,2}$/', $quantity, $result);
    if ($result == 0 || $quantity == 0) {
        header("Location: wishlist.php");
    } else {
        updateWishlist($id, $itemId, $quantity);
    }
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />