//回應碼 $Cxc[2] = ''; //授權碼 $remsg = $authstatus; $response_msg = $OutPPtextBAD; } $str = "update o_auth set remsg='{$remsg}',recode='{$responsecode}',dt='{$rehohsn}',auth='{$Cxc['2']}',rootmemo='{$MeMologXML}',stast='',staed='' where sr='{$aa}' and UserPayNub='{$UserPayNub}' and amount='{$amount}' and auth='' limit 1 "; mysql_query($str, $plink); if ($Cxc[2] && $succ && $form[autoclose]) { //如果是自動關帳,馬上去觸發 $Bank_postURL = 'https://sslpayment.uwccb.com.tw/ssl_Capture.asp'; $post = "storeid=" . $form['mid']; //商店代碼 $post .= "&ordernumber=" . $aa; //訂單編號 $result = my_curl($Bank_postURL, $post); $result = mb_convert_encoding($result, "UTF-8", "BIG5"); //BIG5轉UTF-8 //<EPOS responsecode='-1' responsemsg='商家交易網址錯誤!' /> //responsecode=0 //responsemsg=取消交易作業成功 if ($result) { $xml = simplexml_load_string($result); $bsbc = ''; foreach ($xml->attributes() as $XMLtito => $XMLval) { $bsbc .= $XMLtito . '=' . $XMLval . "<br>"; ${$XMLtito} = $XMLval; } if ($responsecode == '0') { $isdt = substr($hohsn, 0, 8); //取出交易日
$uc_avatar_url = capi_uc_avatar($_SGLOBAL['supe_uid'], empty($_SCONFIG['avatarreal']) ? 'virtual' : 'real', 1); $data = array('Filedata' => '@' . $filepath . ";type=" . $_FILES['Filedata']['type'] . ";filename=" . $_FILES['Filedata']['name']); $curl = my_curl($uc_avatar_url, $data); //capi_runlog('curl',$curl); $result = @json_decode($curl); if ($result->code == 0) { /* $curl_cookie=$separate=''; foreach($_COOKIE as $key => $val) { $curl_cookie.=$separate.$key.'='.$val; $separate=';'; } */ $url = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['SCRIPT_NAME']; $url .= '?ac=avatar&m_auth=' . rawurlencode($_GET['m_auth']); $curl = my_curl($url); //capi_runlog('curl',$curl); $result = @json_decode($curl); if ($result->code == 0) { capi_showmessage_by_data('do_success', 0, array('avatar_url' => avatar($space['uid'], 'middle', TRUE))); } } } capi_showmessage_by_data('non_normal_operation'); } //头像 include_once S_ROOT . './uc_client/client.php'; $uc_avatar = capi_uc_avatar($_SGLOBAL['supe_uid'], empty($_SCONFIG['avatarreal']) ? 'virtual' : 'real'); //判断用户是否设置了头像 $setarr = array(); $avatar_exists = ckavatar($space['uid']);
function my_curl($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $res = curl_exec($ch); curl_close($ch); return $res; } function do_http_request($url, $data, $usePost = true) { $result = false; if (!$usePost) { $url = $url . '?' . http_build_query($data); } //初始化 $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); if ($usePost) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } $result = curl_exec($ch); curl_close($ch); return $result; } echo my_curl($url);
$postBODY .= '&PAN=' . $card_no; $postBODY .= '&EXPIREDATE=' . $exp; $postBODY .= '&EXTENNO=' . $bgm; $getBody = my_curl($postUrl, $postBODY); $rootmemo = base64_encode($getBody); parse_str($getBody); /* rtnCode=2&MerchantID=0100801842&TerminalID=70500176&OrderID=1352880828&TransMode=0&TransDate=20121114&TransTime=161349&TransAmt=50 &ApproveCode=&InstallType=&RedeeemType=&Install=0&Fee=0&FirstAmt=0&EachAmt=0&RedeemUsed=0&RedeemBalance=0&CreditAmt=0&ResponseCode=920 &ResponseMsg=卡號格式錯誤.&PrivateData=UserID=Test1234&UserName=greenworld&UserMsg=MSG&FOREIGN=&SECURE_STATUS= */ //進行幕後授權金額比對 if ($ResponseCode == '00') { $Bank_Nccc_JV = 'https://credit.allpay.com.tw/Api_W/ApiResponse_back.jsp'; $post = "MerchantID={$form['mid']}&OrderID={$OrderID}&"; $result = my_curl($Bank_Nccc_JV, $post); parse_str($result); if ($result) { if ($Rcode == '00' || $Rcode == '08' || $Rcode == '11') { $Rcode = '00'; } if ($Rcode != '00') { $response_msg = '授權失敗'; $str = "update o_auth set remsg='授權失敗',recode='xxa',rootmemo='{$rootmemo}' where sr='{$OrderID}' and auth!='' limit 1 "; @mysql_query($str, $plink); @setlog($set_type, $client, $OrderID . ":幕後授權比對-" . $response_msg, $uip, $t1); //追縱授權-Step5 授權結束 update $running = number_format(microtime(true) - $t3, 3); @exec_sr_tracer($aa, "step5", $running, "g_ssl_wantai.php", "final", 'xxa', $response_msg); echo 'error_授權失敗'; exit;
* 當銀行代號為以下設定時,資料將會轉到 dotNet 版處理。 * 當 dotNet 版本處理完成後會將處理結果送至 g_ssl_result.php 進行後續處理。 2014.09.19 加入sr_tracer記錄 by raleigh 2014.09.22 加入新光用的參數 by andy 2014.09.29 修正回應格式 by raleigh */ if (in_array($form['bank'], $dotNetBanks)) { $szDotNetCreditURI = $dotNetCreditBackgroundURL; // 增加記錄 Step 1 $arRecord = array("Title" => "dotNet 介面 授權追縱 LOG (1) {$aa} g_ssl_dotNet", "Client" => $client, "Bank" => $form[bank], "Time" => date("Y-m-d H:i:s"), "Cup_us" => $form['cup_us'], "CUPus" => $CUPus, "Result" => "Step 1 :進入授權前"); @write_log("g_ssl_dotNet", "SR: " . $aa, $arRecord); // 轉送 dotNet 介面 $szRequestContent = "gwsr={$aa}&expire_dt={$exp}"; // 取回回傳資料 $szResponseContent = my_curl($szDotNetCreditURI, $szRequestContent); @setlog($set_type, $client, $szResponseContent, $uip, $t1); //追縱授權-Step4 授權結束 update $t4 = microtime(true); $running = number_format($t4 - $t3, 3); @exec_sr_tracer($aa, "step4", $running, "g_ssl_dotNet.php"); // 轉字串為變數 parse_str($szResponseContent); /* 將接收的參數做明確的變數宣告 */ /* <標準處理參數> */ $szMerchantID = $MerchantID; $szSubMerchantID = $SubMerchantID; $szTerminalID = $TerminalID; $szMerchantTradeNo = $MerchantTradeNo; $nTradeAmount = (int) $TradeAMT; $szECI = '';
foreach ($eventList as $eventSingle) { if ($eventSingle['name'] == $eventName) { return true; } } return false; } else { return false; } } } // Get the events list for each show page. // Add or remove fields here to expand or contract the query. // Field list at: developers.facebook.com/docs/graph-api/reference/event if (!$contents_allarray) { $contents_allarray = my_curl('https://graph.facebook.com/events?ids=' . $eventpages . '&access_token=' . $access_token . '&fields=id,name,place,picture.type(large),owner,start_time,end_time,timezone,description'); } $json_allarray = json_decode($contents_allarray, true); $split_event_pages = explode(",", $eventpages); $alt_event_rows = explode("\n", $additional_events); /* Convert default timezone to JSON event timezone. if($event_item["timezone"] == "America/Detroit"){ $timezone_offset = "+3 hours";} if($event_item["timezone"] == "America/Chicago"){ $timezone_offset = "+3 hours";} if($event_item["timezone"] == "America/Los_Angeles"){ $timezone_offset = "+3 hours";} if($event_item["timezone"] == "America/New_York"){ $timezone_offset = "+3 hours";} if($event_item["timezone"] == "America/Toronto"){ $timezone_offset = "+3 hours";}*/ $timezone_offset = "+2 hours"; $now = strtotime('now'); // Extract and equalize data for each event and create new $events array. $events_upcoming = array(); foreach ($split_event_pages as $pagename) {
$str = "insert into o_close_bank "; //寫入 $str .= "(sr,client,bank,authsr,dt,amount,cardno,auth,trace_no,stat,eci,sps,mid,tid,pesn,glFrom,glTo,glCity,isGuolu,isdt,citylog,dtymd,allsn,cdmk,escrow,nort,batch,taishin,bankrt,percen,bank_pc,bank_stat,uip)"; $str .= "values('{$szTradeNo}','{$a['client']}','{$a['bank']}','{$a['sr']}','{$hohsn}','{$a['amount']}','','{$a['auth']}','{$a['trace_no']}','要取消','{$a['eci']}','{$a['sps']}','{$MidO['mid']}','{$MidO['tid']}','{$a['pesn']}','{$a['glFrom']}','{$a['glTo']}','{$a['glCity']}','{$a['isGuolu']}','{$isdt}','{$bsb}','{$hohsnYMD}','{$a['allsn']}','{$a['cdmk']}','{$a['escrow']}','{$nort}','0','','0','','','後台取消','{$uip}')"; mysql_query($str, $plink); $szMerchantTradeNo = $a[sr]; $szBank = $a[bank]; // 呼叫 dotNet 的線上取消 if ($szTradeNo && $szMerchantTradeNo && in_array($szBank, $dotNetOnlineCancelBanks)) { $szSQL = "UPDATE o_close SET stat='取消中', bank_stat='取消中' WHERE sr='{$szTradeNo}' AND authsr='{$szMerchantTradeNo}' AND stat='要取消' "; $result = @mysql_query($szSQL, $plink); $szSQL = "UPDATE o_close_bank SET stat='取消中', uip='{$uip}' WHERE sr='{$szTradeNo}' AND authsr='{$szMerchantTradeNo}' AND stat='要取消' "; $result = @mysql_query($szSQL, $plink); $ret = array("File" => "線上關帳 LOG (1) g_auth_close_dotNet_Cancel.php", "Time" => date("Y-m-d H:i:s"), "sr" => $szTradeNo, "authsr" => $szMerchantTradeNo, "result" => $result, "sql" => $szSQL, "error" => mysql_error(), "Note" => "Step 1 : 更新取消授權狀態為'取消中'"); @write_log("g_auth_close_dotNet_Cancel", "client: " . $client, $ret); if ($result) { // 呼叫 dotNet 的取消授權 if ($szTradeNo && $szMerchantTradeNo) { $szParameters = "sr={$szTradeNo}&authsr={$szMerchantTradeNo}"; // 發送線上取消授權,無須處理結果(結果會轉送到 g_ssl_dotNet_Feedback 處理) $szResponse = my_curl($dotNetCreditRefundURL, $szParameters); $ret = array("File" => "線上關帳 LOG (2) g_auth_close_dotNet_Cancel.php", "Time" => date("Y-m-d H:i:s"), "sr" => $szTradeNo, "authsr" => $szMerchantTradeNo, "response" => $szResponse, "Note" => "Step 2 : 取得取消授權結果"); @write_log("g_auth_close_dotNet_Cancel", "client: " . $client, $ret); } } } if ($result) { $doUP = 1; } else { $doUP = 0; }