示例#1
1
文件: purchase.php 项目: jimlucn/cart
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$ship_name = $_POST['ship_name'];
$ship_address = $_POST['ship_address'];
$ship_city = $_POST['ship_city'];
$ship_state = $_POST['ship_state'];
$ship_zip = $_POST['ship_zip'];
$ship_country = $_POST['ship_country'];
do_html_header('结算');
do_html_top();
if (is_array($_SESSION['cart'])) {
    if ($name && $address && $city && $state && $zip && $country) {
        $userid = find_userid($_SESSION['valid_user']);
        if ($order_info = insert_order($_POST, $userid)) {
            display_cart($_SESSION['cart'], false, 1, 1);
            display_card_form($order_info);
        } else {
            echo "订单写入数据库失败";
        }
    } else {
        echo "用户信息填写不完整";
        display_button('checkout.php', '返回');
    }
} else {
    echo "您还没有添加商品到购物车";
    display_button('index.php', '返回首页');
}
do_html_footer();
示例#2
0
<?php

include 'book_sc_fns.php';
// The shopping cart needs sessions, so start one
session_start();
do_html_header("Checkout");
// create short variable names
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
// if filled out
if ($_SESSION['cart'] && $name && $address && $city && $zip && $country) {
    // able to insert into database
    if (insert_order($_POST) != false) {
        //display cart, not allowing changes and without pictures
        display_cart($_SESSION['cart'], false, 0);
        display_shipping(calculate_shipping_cost());
        //get credit card details
        display_card_form($name);
        display_button('show_cart.php', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not store data, please try again.';
        display_button('checkout.php', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('checkout.php', 'back', 'Back');
}
do_html_footer();
示例#3
0
function create_credit_recharge_order()
{
    $success = 0;
    $order_id = '';
    $msg = '';
    $credits = (int) $_POST['creditrechargeNum'] * 100;
    $order_name = '充值' . $credits . '积分';
    $product_id = $_POST['product_id'];
    if (!is_user_logged_in()) {
        $msg = '请先登录';
    } else {
        $user_info = wp_get_current_user();
        $uid = $user_info->ID;
        $user_name = $user_info->display_name;
        $user_email = $user_info->user_email;
        if ($product_id != -4) {
            $msg = '系统发生错误,请刷新再试';
        } else {
            $order_price = $credits / (int) ot_get_option('tin_cash_credit_ratio', 50);
            $order_price = sprintf('%0.2f', $order_price);
            $insert = insert_order($product_id, $order_name, $order_price, 1, $order_price, 1, '', $uid, $user_name, $user_email, '', '', '', '', '');
            if ($insert) {
                $success = 1;
                $order_id = $insert;
                if (!empty($user_email)) {
                    store_email_template($order_id, '', $user_email);
                }
            } else {
                $msg = '创建订单失败,请重新再试';
            }
        }
    }
    $return = array('success' => $success, 'msg' => $msg, 'order_id' => $order_id);
    echo json_encode($return);
    exit;
}
示例#4
0
文件: membership.php 项目: pemiu01/UM
function create_the_vip_order()
{
    $success = 0;
    $order_id = '';
    $msg = '';
    if (!is_user_logged_in()) {
        $msg = '请先登录';
    } else {
        $user_info = wp_get_current_user();
        $uid = $user_info->ID;
        $user_name = $user_info->display_name;
        $user_email = $user_info->user_email;
        $product_id = $_POST['product_id'];
        if ($product_id == -4) {
            $order_price = um_get_setting('life_mb_price', 120);
            $order_name = '终身会员';
        } elseif ($product_id == -3) {
            $order_price = um_get_setting('annual_mb_price', 45);
            $order_name = '年费会员';
        } elseif ($product_id == -2) {
            $order_price = um_get_setting('quarterly_mb_price', 12);
            $order_name = '季费会员';
        } else {
            $order_price = um_get_setting('monthly_mb_price', 5);
            $order_name = '月费会员';
        }
        $ratio = um_get_setting('aff_ratio', 10);
        $rewards = $order_price * $ratio / 100;
        $rewards = (int) $rewards;
        $insert = insert_order($product_id, $order_name, $order_price, 1, $order_price, 1, '', $uid, $_POST['aff_user_id'], $rewards, $user_name, $user_email, '', '', '', '', '');
        if ($insert) {
            $success = 1;
            $order_id = $insert;
            if (!empty($user_email)) {
                store_email_template($order_id, '', $user_email);
            }
        } else {
            $msg = '创建订单失败,请重新再试';
        }
    }
    $return = array('success' => $success, 'msg' => $msg, 'order_id' => $order_id);
    echo json_encode($return);
    exit;
}
示例#5
0
function insert_db_row($dbh, $row)
{
    $name = $row['Name'];
    $email = $row['E-mail'];
    # check if they are in the people table first
    $pid = person_exists($dbh, $name, $email);
    if (is_null($pid)) {
        $pid = insert_person($dbh, $name, $email);
        $oid = insert_order($dbh, $pid, $row['Spaces'], '', 1, $pid);
    }
    # check number of tickets
    $tickets = get_tickets($dbh, $pid);
    if (count($tickets) != $row['Spaces']) {
        # Delete and regenerate all tickets
        delete_tickets($dbh, $pid);
        generate_tickets_pdf($dbh, $pid, $pid, $row);
    }
    # Return something useful to indicate what we just did
}
<?php

include 'book_sc_fns.php';
// The shopping cart needs sessions, so start one
session_start();
do_html_header("Checkout");
//create short variable names
$name = $HTTP_POST_VARS['name'];
$address = $HTTP_POST_VARS['address'];
$city = $HTTP_POST_VARS['city'];
$zip = $HTTP_POST_VARS['zip'];
$country = $HTTP_POST_VARS['country'];
// if filled out
if ($HTTP_SESSION_VARS['cart'] && $name && $address && $city && $zip && $country) {
    // able to insert into database
    if (insert_order($HTTP_POST_VARS) != false) {
        //display cart, not allowing changes and without pictures
        display_cart($HTTP_SESSION_VARS['cart'], false, 0);
        display_shipping(calculate_shipping_cost());
        //get credit card details
        display_card_form($name);
        display_button('show_cart.php', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not store data, please try again.';
        display_button('checkout.php', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('checkout.php', 'back', 'Back');
}
do_html_footer();
function create_the_vip_order()
{
    $success = 0;
    $order_id = '';
    $msg = '';
    if (!is_user_logged_in()) {
        $msg = '请先登录';
    } else {
        $user_info = wp_get_current_user();
        $uid = $user_info->ID;
        $user_name = $user_info->display_name;
        $user_email = $user_info->user_email;
        $product_id = $_POST['product_id'];
        if ($product_id == -3) {
            $order_price = ot_get_option('vip_annual_price', 90);
            $order_name = '年费会员';
        } elseif ($product_id == -2) {
            $order_price = ot_get_option('vip_quarterly_price', 25);
            $order_name = '季费会员';
        } else {
            $order_price = ot_get_option('vip_monthly_price', 10);
            $order_name = '月费会员';
        }
        $insert = insert_order($product_id, $order_name, $order_price, 1, $order_price, 1, '', $uid, $user_name, $user_email, '', '', '', '', '');
        if ($insert) {
            $success = 1;
            $order_id = $insert;
            if (!empty($user_email)) {
                store_email_template($order_id, '', $user_email);
            }
        } else {
            $msg = '创建订单失败,请重新再试';
        }
    }
    $return = array('success' => $success, 'msg' => $msg, 'order_id' => $order_id);
    echo json_encode($return);
    exit;
}
示例#8
0
session_start();
// Require_one: Load 1 lần  file 'book_f.php'
require_once 'book_f.php';
/* echo "<pre>";
	print_r($_POST);
	echo"</pre>"; */
// Bung các POST thành các biến
extract($_POST);
/*echo "<pre>";
		print_r($_POST);
		echo"</pre>"; */
if ($card_type && $card_number && $card_month && $card_year && $card_name) {
    //echo "if";
    if (process_card($_POST)) {
        // Học tiếp ngày 28.11.2015
        $orderid = insert_order();
        // Đơn đặt hàng vào CSDL, và trả về orderid giao cho KH
        if ($orderid != "") {
            display_cart($_SESSION['cart'], false, 0);
            display_shipping(calculate_shipping_cost());
            echo "Cám ơn quý khách đã giao dịch ĐDH của quý khách đã được nhận<br>";
            echo "Orderid của quý khách là:{$orderid} xin nhớ mã này để tiện giao dịch<br>";
            unset($_SESSION['cart']);
            unset($_SESSION['items']);
            unset($_SESSION['total_price']);
            unset($_POST);
        } else {
            echo "Có lỗi không thể xử lý được ĐDH. Xin vui lòng thực hiện lại<br>";
            return false;
        }
    } else {