<?php

if (isset($_POST['deleteFromCart'])) {
    $which = $_POST['deleteFromCart'];
    removeFromCart($which);
}
if (isset($_POST['makeBooking'])) {
    $movie = $_POST['movie'];
    $date = (double) $_POST['day'];
    $sessiontime = $_POST['time'];
    $seats = array();
    $seats['SA'] = $_POST['SA'];
    $seats['SP'] = $_POST['SP'];
    $seats['SC'] = $_POST['SC'];
    $seats['FA'] = $_POST['FA'];
    $seats['FC'] = $_POST['FC'];
    $seats['B1'] = $_POST['B1'];
    $seats['B2'] = $_POST['B2'];
    $seats['B3'] = $_POST['B3'];
    $price = calculatePrice($seats, $date);
    foreach ($seats as $k => $v) {
        if ($v == 0) {
            unset($seats[$k]);
        }
    }
    addToCart($movie, $date, $price, $sessiontime, $seats);
}
if (isset($_POST['firstname'])) {
    checkOut($_POST['firstname'], $_POST['lastname'], $_POST['phone'], $_POST['emailaddress']);
    unset($_POST['firstname']);
}
示例#2
0
文件: index.php 项目: nitzanb/letseat
$url = $_SERVER['REQUEST_URI'];
$url = trim($url, '/');
$location = explode('/', $url);
if ($location[0] == '') {
    $sitemap['location'] = 'main';
} else {
    $sitemap['location'] = $location[0];
}
if (isset($location[1])) {
    $sitemap['action'] = $location[1];
}
if (!isAdmin() && in_array($sitemap['location'], $adminPages)) {
    header('Location: ' . HOME);
}
if ($sitemap['location'] == 'removeitem') {
    removeFromCart($sitemap['action']);
    header('Location: ' . HOME . 'mycart');
}
if ($sitemap['action'] == 'logout') {
    session_destroy();
    session_start();
}
get_header();
//Call the header
$path = ABSPATH . 'theme/' . $sitemap['location'] . '.php';
if (file_exists($path)) {
    include $path;
} else {
    include ABSPATH . 'theme/slug.php';
}
?>
示例#3
0
 * Created by PhpStorm.
 * User: master
 * Date: 2016/7/13
 * Time: 20:47
 */
session_start();
$project = $_SESSION['project'];
$option = $_POST['option'];
$items = $_POST['items'];
//$items = json_decode($items,true);
if ($option == 'add') {
    addToCart($items, $project);
    echo "success";
} else {
    if ($option == 'remove') {
        removeFromCart($items, $project);
        //print_r($_SESSION[$project]['idList']);
        echo "success";
    } else {
        if ($option == 'show') {
            echo json_encode($_SESSION[$project]['idList']);
        } else {
            if ($option = 'removeAll') {
                removeAll($project);
                echo "success";
            }
        }
    }
}
function addToCart($items, $project)
{
示例#4
0
</td>
                <td class="text-center"><?php 
        echo _h($v['locationName']);
        ?>
</td>
                </td>
                <td class="text-center">
                	<div class="col-md-12">
                    	<select name="regAction[]" class="selectpicker form-control" data-style="btn-info" data-size="10" data-live-search="true" required>
							<option value="">&nbsp;</option>
                    		<option value="remove"><?php 
        echo _t('Remove');
        ?>
</option>
                    		<?php 
        if (removeFromCart($v['courseSecID'])) {
            ?>
                    		<option value="register"><?php 
            echo _t('Register');
            ?>
</option>
                    		<?php 
        }
        ?>
                    	</select>
                    </div> 
                	<input type="hidden" name="courseSecID[]" value="<?php 
        echo _h($v['courseSecID']);
        ?>
" />
                	<input type="hidden" name="courseSecCode[]" value="<?php 
示例#5
0
session_start();
include '../API/curl_api.php';
include '../../config/config.php';
$cart_action = htmlspecialchars($_POST["cart_action"]);
$token = preg_replace('/\\s+/', '', $_SESSION['authtoken']);
switch ($cart_action) {
    case "addTocart":
        $pet_id = htmlspecialchars($_POST["pet_id"]);
        $pet_price = htmlspecialchars($_POST["pet_price"]);
        $pet_image = htmlspecialchars($_POST["pet_image"]);
        addToCart($pet_id, $pet_price, $pet_image);
        break;
    case "removeFromcart":
        $pet_id = htmlspecialchars($_POST["pet_id"]);
        $cart = $_SESSION['cart'];
        removeFromCart($pet_id, $cart);
        break;
    case "placeOrder":
        $url = 'http://' . TRANSACTION_SERVICE . ':' . TRANSACTION_SERVICE_PORT . '/transaction/';
        $cart = $_SESSION['cart'];
        $cart_ids = array();
        foreach ($cart as $json) {
            array_push($cart_ids, $json['id']);
        }
        $card_number = htmlspecialchars($_POST["card_number"]);
        $card_holder_name = htmlspecialchars($_POST["card_holder_name"]);
        $card_cvc = htmlspecialchars($_POST["card_cvc"]);
        $cart_total = $_SESSION['carttotal'];
        $data = array("pets" => $cart_ids, 'total' => $cart_total, 'creditCard' => array("number" => $card_number, "name" => $card_holder_name, "cvc" => $card_cvc));
        placeOrder($url, $token, json_encode($data));
        break;
示例#6
0
<body>
  <?php 
if (!isset($_SESSION)) {
    session_start();
}
?>
  
    <div class ="Center-Nav" style="text-align: center;width:1250px">
      <br><br>
      <?php 
include_once "manage_cart.php";
include_once "connect.php";
if (!empty($_GET["action"])) {
    switch ($_GET["action"]) {
        case "remove":
            removeFromCart($_GET["pd_id"]);
            break;
        case "empty":
            unset($_SESSION["cart_item"]);
            break;
    }
}
if (!empty($_SESSION["cart_item"])) {
    ?>
        <h3>Your Cart Summary</h3>
        <b><a href='cart_items.php?action=empty'>Empty Cart</a></b>
        <table class="imagetable">
          <tr>
            <th>product Name</th>
            <th>Quantity</th>
            <th>Price</th>
示例#7
0
/**
 * Функция которая возвращает массив информации
 * о просматриваемой страничка с типом $type
 * и $id
 * @param null $type
 * @param null $id
 * @return array
 */
function getContent($type = null, $id = null)
{
    /*Если параметры null, то выводим страничку по умолчанию*/
    if ($type == null) {
        $type = DEFAULT_PAGE;
    }
    if (isset($_POST['new_submit']) && $_POST['new_submit']) {
        $type = NEW_SUBMIT_TYPE;
    }
    $loginStatus = LOGIN_ALREADY;
    if (isset($_GET['unlogin']) && $_GET['unlogin']) {
        unlogin();
        $loginStatus = LOGIN_EXIT;
    }
    if ($_POST['submit']) {
        $loginStatus = login($_POST['login'], $_POST['password']);
    }
    /*Инициализируем информацию в зависимости от типа */
    $array = array();
    switch ($type) {
        /*Если тип страницы - текстовая*/
        case TEXT_TYPE:
            /*Если id не инициализирован выводим главную.
            		Иначе страницу с id*/
            if ($id == null) {
                $id = MAIN_PAGE_TEXT_ID;
            }
            /*Получаем текст из базы*/
            $page = getTextContent($id);
            $array['content'] = $page['text'];
            break;
        case CATALOG_TYPE:
            /*Если id не инициаизирован */
            if (!($id > 0)) {
                /*Выбираем первый попавшийся театр*/
                $sql = "SELECT id from theatures LIMIT 1";
                $res = mysql_query($sql);
                $row = mysql_fetch_array($res);
                $id = $row['id'];
            }
            /*Получаем спектали из базы*/
            $items = getCatalogItems($id);
            //$parent_item = get;
            /*Вставляем их в ш для красивого вывода*/
            $array['content'] = (include 'templates/content/item/items.php');
            break;
        case ITEM_TYPE:
            $item = getItem($id);
            $array['content'] = (include 'templates/content/item/item_big.php');
            break;
        case NEW_REG_TYPE:
            $array['content'] = (include 'templates/content/login/newreg.php');
            break;
        case NEW_SUBMIT_TYPE:
            //Если пароли совпадают
            if ($_POST['new_password1'] == $_POST['new_password2']) {
                if (addNewUser($_POST['new_login'], $_POST['new_password2'])) {
                    $array['content'] = 'Поздравляем вы зарегистерированы';
                } else {
                    $array['content'] = 'Такой пользователь уже есть';
                }
            } else {
                $array['content'] = 'Пароли не совпадают';
            }
            break;
        case ADD_CART_TYPE:
            addToCart($id);
            $cartItems = getCartItems();
            $sum = calculateCart();
            $array['content'] = (include 'templates/content/cart/cart.php');
            break;
        case CART_TYPE:
            $cartItems = getCartItems();
            $sum = calculateCart();
            $array['content'] = (include 'templates/content/cart/cart.php');
            break;
            /*Удаляем одну штуку*/
        /*Удаляем одну штуку*/
        case REMOVE_CART_TYPE:
            $cartItems = getCartItems();
            $sum = calculateCart();
            removeFromCart($id);
            $array['content'] = (include 'templates/content/cart/cart.php');
            break;
            /*Удаляем весь товар*/
        /*Удаляем весь товар*/
        case REMOVE_ITEM_CART_TYPE:
            $cartItems = getCartItems();
            $sum = calculateCart();
            removeFromCart($id, CART_REMOVE_ALL);
            $array['content'] = (include 'templates/content/cart/cart.php');
            break;
        case CLEAR_CART_TYPE:
            $cartItems = getCartItems();
            $sum = calculateCart();
            clearCart();
            $array['content'] = (include 'templates/content/cart/cart.php');
            break;
    }
    $user = getCurrentUser();
    $array['theatures'] = getCatalogCategories();
    $items = getCatalogCategories();
    $array['leftPanel'] = (include 'templates/content/catalog/catalogCategories.php');
    $array['rightPanel'] = (include 'templates/content/login/login.php');
    $array['banner_word'] = 'Театры';
    $array['title'] = 'Сайт';
    return $array;
}
<?php

include '../_php/functions.php';
removeFromCart();