Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('CORE_API_HTTP_USR', 'merchant_17877');
- define('CORE_API_HTTP_PWD', '17877HybqJ3XmpjI7GVKv7e7OLM83xEtfWs');
- $bk = 'https://www.baokim.vn/the-cao/restFul/send';
- $user = $_POST['txtuser'];
- $seri = isset($_POST['txtseri']) ? $_POST['txtseri'] : '';
- $sopin = isset($_POST['txtpin']) ? $_POST['txtpin'] : '';
- //Loai the cao (VINA, MOBI, VIETEL, VTC, GATE)
- switch ($cardtype){
- case 'MobiPhone': // Mobifone
- $card_type_bk = 'MOBI';
- break;
- case 'VinaPhone': // Vinaphone
- $card_type_bk = 'VINA';
- break;
- case 'Viettel': // Viettel
- $card_type_bk = 'VIETEL';
- break;
- default : $card_type_bk = 'Unknow';
- }
- //Mã MerchantID dang kí trên B?o Kim
- $merchant_id = '17877';
- //Api username
- $api_username = 'muhpcom';
- //Api Pwd d
- $api_password = 'muhpcom98ugvsHAGs6';
- //Mã TransactionId
- $transaction_id = time();
- //mat khau di kem ma website dang kí trên B?o Kim
- $secure_code = 'adffde71d02d99bb';
- $arrayPost = array(
- 'merchant_id'=>$merchant_id,
- 'api_username'=>$api_username,
- 'api_password'=>$api_password,
- 'transaction_id'=>$transaction_id,
- 'card_id'=>$card_type_bk,
- 'pin_field'=>$card_num_encode,
- 'seri_field'=>$card_serial_encode,
- 'algo_mode'=>'hmac'
- );
- ksort($arrayPost);
- $data_sign = hash_hmac('SHA1',implode('',$arrayPost),$secure_code);
- $arrayPost['data_sign'] = $data_sign;
- $curl = curl_init($bk);
- curl_setopt_array($curl, array(
- CURLOPT_POST=>true,
- CURLOPT_HEADER=>false,
- CURLINFO_HEADER_OUT=>true,
- CURLOPT_TIMEOUT=>30,
- CURLOPT_RETURNTRANSFER=>true,
- CURLOPT_SSL_VERIFYPEER => false,
- CURLOPT_HTTPAUTH=>CURLAUTH_DIGEST|CURLAUTH_BASIC,
- CURLOPT_USERPWD=>CORE_API_HTTP_USR.':'.CORE_API_HTTP_PWD,
- CURLOPT_POSTFIELDS=>http_build_query($arrayPost)
- ));
- $data = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- $result = json_decode($data,true);
- date_default_timezone_set('Asia/Ho_Chi_Minh');
- $time = date("Y-m-d H:i:s",time());
- if(isset($result['transaction_id'])){
- if($status==200)//n?p th? dúng
- {
- $edit_menhgia = $result['amount'];
- $edit_menhgia = abs(intval($edit_menhgia));
- $up_stat = 2;
- $logcontent_after = "Thông tin th?: Th? dúng. M?nh giá: $menhgia VNÐ.";
- } else { //n?p th? sai
- $error_code = $reponse_bk->error_code;
- $notice = $result['errorMessage'];
- $up_stat = 3;
- $logcontent_after = "Th? sai.";
- }
- // Write Log Nap Bao Kim
- $logcontent = "Tài kho?n K?t n?i: $username_bk. M?t kh?u K?t n?i: $password_bk. Mã WebSite: $merchant_id. M?t kh?u: $secure_pass. Mã th?: $card_num_encode, Seri th?: $card_serial_encode. URL n?p: $url. ";
- $logcontent .= $logcontent_after;
- _writelog("log_autobaokim.txt", $logcontent);
- // End Write Log Nap Bao Kim
- include('autonap_duyet.php');
- }else{
- $notice_nap = "Äăng kà mua V.Point bằng thẻ <strong>$cardtype</strong> cho tà i khoản <strong>$login</strong> thà nh công. Hãy theo dõi trong phần danh sách thẻ đã nạp.";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement