示例#1
0
if (isset($_POST['t_submit'])) {
    $send_url = '';
    $rev_params = $_POST;
    # 測試UI用參數
    unset($rev_params['check_mac']);
    if (isset($_POST['check_mac']) and $_POST['check_mac'] == 'on') {
        $send_url = 'https://' . ECBANK_IP . '/gateway_v2.php';
        if (isset($_POST['mer_id']) and !empty($_POST['mer_id'])) {
            # 取得 HashKey, HashIV
            $mer_id = $_POST['mer_id'];
            $sql = 'SELECT hashkey, hashiv FROM tblMerchants_Key WHERE mer_id = ' . $mer_id . ' LIMIT 1;';
            $sql_result = $db->query($sql);
            $row = $db->fetch_array($sql_result);
            $hash_key = $row['hashkey'];
            $hash_iv = $row['hashiv'];
            $check_mac_value = GenerateCheckMacValue($rev_params, $hash_key, $hash_iv);
        } else {
            $error = 'ECBank商店代號 不可為空';
        }
    } else {
        $send_url = 'https://' . ECBANK_IP . '/gateway.php';
    }
    # 轉導至 gateway.php , gateway_v2.php
    if (empty($error)) {
        set_html('<form id="ecbank_form" action="' . $send_url . '" method="POST">', 4);
        foreach ($rev_params as $param_name => $param_val) {
            if (gettype($param_val) == 'array') {
                foreach ($param_val as $p_idx => $p_val) {
                    set_html('<input type="hidden" name="' . $param_name . '[]" value="' . $p_val . '">', 6);
                }
            } else {
示例#2
0
文件: t_post.php 项目: sac071213/dev
<?php

define('WEB_ROOT', 'C:/wamp/www/dev');
include WEB_ROOT . '/tpl/header.php';
include WEB_ROOT . '/lib/html_common.inc';
include WEB_ROOT . '/lib/misc.inc';
include WEB_ROOT . '/lib/ecbank_security.inc';
$frm_params = array('mer_id' => '9493', 'payment_type' => 'alipay', 'amt' => '100', 'goods_name' => array('A10000', 'A10000'), 'goods_amount' => array('1', '2'), 'od_sob' => 'ali' . date('ymdHis'), 'return_url' => 'http://localhost/dev/web/ecbank_alipay/t_ecbank_returl_url.php', 'ok_url' => 'https://ecbank.com.tw/_payment/test.php', 'buyer_email' => '*****@*****.**', 'buyer_tel' => '0911222333', 'buyer_name' => '消費者');
$hash_key = 'b1e02828a01a08eb';
$hash_iv = '6deabfa3776f4432';
$mac_val_params = $frm_params;
$frm_params['checkmacvalue'] = GenerateCheckMacValue($mac_val_params, $hash_key, $hash_iv);
if (isset($frm_params['checkmacvalue'])) {
    $frm_act = 'https://ecbank.com.tw/gateway_v2.php';
} else {
    $frm_act = 'https://ecbank.com.tw/gateway.php';
}
$html = genSimpleForm($frm_act, $frm_params, '_blank');
echo $html;
include WEB_ROOT . '/tpl/footer.php';