Exemple #1
0
<?php

global $global_params;
global $page_params;
require_once FUNCTIONS_DIR . "common.functions.inc.php";
require_once FUNCTIONS_DIR . "shop.functions.php";
require_once FUNCTIONS_DIR . "mobile.functions.php";
if (!isset($_SESSION['mobile_flag']) && !isset($_SESSION['mobile_device'])) {
    $mobile_detect = mobile_device_detect();
    $_SESSION['mobile_flag'] = $mobile_detect['mobile_browser'];
    $_SESSION['mobile_device'] = $mobile_detect['status'];
}
$page_params['page_title'] = "Shop";
set_db_active_new("DB_URL");
check_cookie_set();
if (isset($global_params['page_arguments']['action_shop']) && $global_params['page_arguments']['action_shop'] == "shop") {
    $product_id = $global_params['page_arguments']['shop_pid'];
    $explode = explode("@", $product_id);
    $bid = $explode[0];
    $pid = $explode[1];
    if (func_check_bid_pid($global_params["db_indv_conns"]['DB_URL'], $bid, $pid)) {
        //USE THE BELOW LINES WHEN YOU DO NOT HAVE MY_CRYPTE INSTALLED IN PHP
        $encoded_bid = base64_encode($bid);
        $encoded_pid = base64_encode($pid);
        //USE THE BELOW LINES WHEN YOU HAVE MY_CRYPT INSTALLED IN PHP
        //$encoded_bid = decrypt($bid);
        //$encoded_pid = decrypt($pid);
        header("location: /shop/cart.html?bid={$encoded_bid}&pid={$encoded_pid}");
        exit;
    } else {
        $err_msg = "Oops! Could not fetch the product details.\nPlease scan the barcode again or enter the product id below\n";
<?php

global $global_params;
global $page_params;
require_once FUNCTIONS_DIR . "common.functions.inc.php";
require_once FUNCTIONS_DIR . "order.functions.php";
require_once LIB_DIR . "JSON.php";
$page_params['page_title'] = "Checkout";
set_db_active_new('DB_URL');
if (!isset($_COOKIE[CART_COOKIE])) {
    echo "Cookie disbaled for the browser";
    exit;
}
if (isset($_SESSION[CART_SESSION]) && !empty($_SESSION[CART_SESSION])) {
    $session_val = $_SESSION[CART_SESSION];
    if (is_array($_SESSION[$session_val]) && !empty($_SESSION[$session_val])) {
        $total_cost = $_SESSION[$session_val . "_order_dtl"]['total_cost'];
        if (isset($global_params['page_arguments']['action']) && $global_params['page_arguments']['action'] == "submit") {
            $err_flag = FALSE;
            //p($_SESSION[$session_val."_order_dtl"]); p($global_params['page_arguments']); exit;
            $order_dtl_arr = $_SESSION[$session_val . "_order_dtl"];
            $cust_dtl_arr = array();
            $cust_dtl_arr['cust_name'] = $global_params['page_arguments']['cust_name'];
            $cust_dtl_arr['cust_no'] = $global_params['page_arguments']['cust_no'];
            $cust_dtl_arr['cust_add'] = $global_params['page_arguments']['cust_add'];
            $cust_dtl_arr['cust_pincode'] = $global_params['page_arguments']['cust_pincode'];
            $cust_dtl_arr['cust_email'] = $global_params['page_arguments']['cust_email'];
            $cust_ret_arr = func_get_cust_id($global_params["db_indv_conns"]['DB_URL'], $cust_dtl_arr);
            if ($cust_ret_arr['error_code'] == 1) {
                $err_flag = TRUE;
                $err_msg = $cust_ret_arr['err_msg'];