Пример #1
0
<?php

include 'modules.php';
if (!isset($_COOKIE['uid'])) {
    header('Location: index');
}
$pid = $_GET["pid"];
$type = findType($pid);
$uid = $_COOKIE['uid'];
if (isset($_POST['addToWishButton'])) {
    //echo $_COOKIE['uid'];
    addToWish($pid, $uid);
    //exit();
} else {
    if (isset($_POST['addToCartButton'])) {
        addToCart($pid, $uid, $_POST['quantity'], $_POST['filter']);
        //exit();
    }
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="ISO-8859-1">
	<title>Product Page</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet"
	href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
	<script
	src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
	<script
Пример #2
0
    //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
        }
    }
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<?php 
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
    header('X-UA-Compatible: IE=edge,chrome=1');
Пример #3
0
$itemId = $_GET['itemId'];
$remove = $_GET['remove'];
$update = $_GET['u'];
$q = $_GET['quant'];
$wishList = $_GET['w'];
if ($remove == 1) {
    deleteItem($itemId);
}
if ($remove == 2) {
    // remove all items
    unset($_SESSION['basket']);
}
if ($wishList == 1) {
    if (isset($_SESSION['UserSession'])) {
        $userId = $_SESSION['UserSession'][0]['userId'];
        addToWish($userId, $itemId, $q);
        // add item to wishlist
        deleteItem($itemId);
        // remove it from basket
    } else {
        header("Location:signin.php?notLogged=2&r=wL");
    }
}
if ($update == 1) {
    $result = preg_match('/^[0-9]{1,2}$/', $q);
    // validation
    if ($result === 0 || $q == 0 || $q > 99) {
        header("Location:basket.php");
    } else {
        $itemsInBask = count($_SESSION['basket']);
        for ($i = 0; $i < $itemsInBask; $i++) {