示例#1
0
文件: process.php 项目: jimlucn/cart
$order_info_orderid = $_POST['order_info_orderid'];
$type = $_POST['type'];
$number = $_POST['number'];
$secure_number = $_POST['secure_number'];
$month = $_POST['month'];
$year = $_POST['year'];
$name = $_POST['name'];
do_html_header('支付');
do_html_top();
if ($_POST['submit'] && $_SESSION['cart'] && $_POST['order_info_userid'] && $_POST['order_info_orderid'] && $_POST['type'] && $_POST['number'] && $_POST['secure_number'] && $_POST['month'] && $_POST['year'] && $_POST['name']) {
    display_cart($_SESSION['cart'], false, 1, 1);
    if (query_order_pay($order_info_orderid) == PAYED) {
        echo "您的订单已经支付成功,无需再次支付。您的订单号:" . $order_info_orderid;
    }
    if (query_order_pay($order_info_orderid) == UNPAYED) {
        if (process_card()) {
            change_order_status($order_info_orderid);
            $date = date("Y-m-d H:i:s");
            echo "您的订单支付成功。支付时间:" . $date . "。您的订单号:" . $order_info_orderid;
            unset($_SESSION['cart']);
            unset($_SESSION['total_price']);
            unset($_SESSION['items']);
        } else {
            echo "您的信用卡有误。";
        }
    } else {
        echo "错误2<br>";
        echo query_order_pay($order_info_orderid);
    }
} else {
    echo "支付信息请填完整";
<?php

include 'book_sc_fns.php';
// The shopping cart needs sessions, so start one
session_start();
do_html_header('Checkout');
$card_type = $HTTP_POST_VARS['card_type'];
$card_number = $HTTP_POST_VARS['card_number'];
$card_month = $HTTP_POST_VARS['card_month'];
$card_year = $HTTP_POST_VARS['card_year'];
$card_name = $HTTP_POST_VARS['card_name'];
if ($HTTP_SESSION_VARS['cart'] && $card_type && $card_number && $card_month && $card_year && $card_name) {
    //display cart, not allowing changes and without pictures
    display_cart($HTTP_SESSION_VARS['cart'], false, 0);
    display_shipping(calculate_shipping_cost());
    if (process_card($HTTP_POST_VARS)) {
        //empty shopping cart
        session_destroy();
        echo 'Thankyou for shopping with us.  Your order has been placed.';
        display_button('index.php', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not process your card. ';
        echo 'Please contact the card issuer or try again.';
        display_button('purchase.php', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('purchase.php', 'back', 'Back');
}
do_html_footer();
示例#3
0
<?php

//session_start();
do_html_header('Checkout');
$card_type = $_POST['card_type'];
$card_number = $_POST['card_number'];
$card_month = $_POST['card_month'];
$card_year = $_POST['card_year'];
$card_name = $_POST['card_name'];
if (isset($_SESSION['cart']) && isset($card_type) && isset($card_number) && isset($card_month) && isset($card_year) && isset($card_name)) {
    //display cart, not allowing changes and without pictures
    display_cart($_SESSION['cart'], false, 0);
    display_shipping(calculate_shipping_cost());
    if (process_card($_POST)) {
        //empty shopping cart
        session_destroy();
        echo 'Thankyou for shopping with us.  Your order has been placed.';
        display_button('index', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not process your card. ';
        echo 'Please contact the card issuer or try again.';
        display_button('purchase', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('purchase', 'back', 'Back');
}