$rech_sr = mysql_real_escape_string($rech_sr); $str = "SELECT client,amount,dt FROM o_auth WHERE sr='{$rech_sr}' limit 1 "; $qq = mysql_query($str, $plink); $form = @mysql_fetch_array($qq); $rech_amount = $form['amount']; if ($form['dt'] != $rech_time) { echo 'valid=2'; //失敗 exit; } if ($amt != $rech_amount) { echo 'valid=3'; //失敗 exit; } $strCHMA = "SELECT chma FROM o_user WHERE client='{$form['client']}' limit 1 "; $qqCHMA = mysql_query($strCHMA, $plink); $f_CHMA = @mysql_fetch_array($qqCHMA); $rech_chma = $f_CHMA['chma']; //店家檢查碼 $rech_body = $rech_time . $rech_sr . $rech_amount; $rech_key = data_crypt($rech_chma, $key, 'decrypt'); // 解密後的資料 if ($rech_body == $rech_key) { echo 'valid=1'; //完成 } else { echo 'valid=0'; //失敗 } //======
} $TOkSi = substr($rehohsn, 8, 6) + $Cxc[3] + $amount; //process_time+gwsr+amount $spcheck = gwSpcheck($form['chma'], $TOkSi); //商店檢查碼,值 //==============spcheck檢查碼 end //==================新的幕後回傳檢核 $rech_time = substr($rehohsn, 0, 14); //20121231101030 回傳的時間dt $rech_sr = $Cxc[3]; //單號 $rech_chma = $form['chma']; //店家檢查碼 $rech_amount = $amount; $rech_body = $rech_time . $rech_sr . $rech_amount; $rech_key = data_crypt($rech_chma, $rech_body, 'encrypt'); //加密後的資料 //====== //==============送出電子發票 if ($inv_active == 1 && $succ == 1) { $inv_sr = $aa; $inv_amt = $amount; $inv_order_no = $od_sob; $inv_client = $client; include 'g_invoice.php'; } //==============送出電子發票end //===============有 BK_ch_URL 的, 進行幕後觸發 if ($form[urlbk] && !$bk_posturl) { $bk_posturl = $form[urlbk]; }
// 最大9碼輸出 } $szToken = substr($szTradeDateTime, 8, 6) + $szMerchantTradeNo + $nTradeAmount; // $szSpcheck = gwSpcheck($arUser['chma'], $szToken); //商店檢查碼,值 // 新的幕後回傳檢核參數 $szRechTime = substr($szTradeDateTime, 0, 14); // 20121231101030 回傳的時間 $szRechSr = $szMerchantTradeNo; // 單號 $szRechChma = $arUser['chma']; // 店家檢查碼 $szRechAmount = $nTradeAmount; $szRechBody = $szRechTime . $szRechSr . $szRechAmount; $szRechKey = data_crypt($szRechChma, $szRechBody, 'encrypt'); // 加密後的資料 $nClient = $arOrigionAuth['client']; /* // 送出電子發票 if ($szReturnCode == '1') { // 準備電子發票所須參數 $inv_sr = $szMerchantTradeNo; $inv_amt = $nTradeAmount; $inv_order_no = $arOrigionAuth['sob']; $inv_client = $nClient; $plink = $databaseLink; // 呼叫電子發票 include('g_invoice.php'); } */