function dl_recharge($AppId) { log::init('./log', 'dl_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $config = (include "config.php"); $pf_info = $config["dl"][$AppId]; $str = "order=" . stripslashes($_GET["order"]) . "&money=" . stripslashes($_GET["money"]) . "&mid=" . stripslashes($_GET["mid"]) . "&time=" . stripslashes($_GET["time"]) . "&result=" . stripslashes($_GET["result"]) . "&ext=" . stripslashes($_GET["ext"]) . "&key=" . $pf_info["AppKey"]; $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["signature"])) { log::instance()->error("ret: 签名无效"); exit; } echo "success"; $note = json_decode(stripslashes($_GET["ext"]), true); $ret = recharge($pf_info["PF"], $note["sid"], $note["odr"], $note["uid"], $note["item"], stripslashes($_GET["money"]), stripslashes($_GET["order"]), 0); log::instance()->debug("ret: " . $ret); if ($ret != "SUCCESS" && $ret != "TRADE_NO NOT EXIST") { $str = "app_id={$AppId}" . "&mid=" . stripslashes($_GET["mid"]) . "&order_no=" . stripslashes($_GET["order"]) . "&key=" . $pf_info["AppKey"]; $sign = strtolower(md5($str)); $url = "http://connect.d.cn/open/pay-async/refund" . "?app_id=" . urlencode($AppId) . "&mid=" . urlencode(stripslashes($_GET["mid"])) . "&order_no=" . urlencode(stripslashes($_GET["order"])) . "&sig=" . urlencode($sign); $response = file_get_contents($url); log::instance()->debug("refund: order:" . stripslashes($_GET["order"]) . " ret:{$response}"); } }
function mz_recharge($AppId) { log::init('./log', 'mz_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $config = (include "config.php"); $pf_info = $config["mz"][$AppId]; $str = stripslashes($_POST["username"]) . "|" . stripslashes($_POST["change_id"]) . "|" . stripslashes($_POST["money"]) . "|" . $pf_info["AppKey"]; $sign = stripslashes($_POST["hash"]); if (strtolower(md5($str)) != $sign) { log::instance()->error("ret: 签名无效"); echo "0"; exit; } $note = json_decode(stripslashes($_POST["object"]), true); $ret = recharge($pf_info["PF"], $note["sid"], $note["odr"], $note["uid"], $note["item"], stripslashes($_POST["money"]), stripslashes($_POST["change_id"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "1"; } else { echo "0"; } }
$body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $body = json_decode(urldecode($body), true); //$url = "https://buy.itunes.apple.com/verifyReceipt"; $url = "https://sandbox.itunes.apple.com/verifyReceipt"; $receipt = json_encode(array("receipt-data" => $body["receipt-data"])); $response = sendPostData($url, $receipt); $content = json_decode($response['content'], true); if ($content["status"] !== 0) { log::instance()->error("ret: 验证失败 errCode:" . $content["status"]); echo "fail"; exit; } $pf_info = $config["apple"]["appstore"]; $note = $content["receipt"]; $ret = recharge($pf_info["PF"], $body["sid"], $body["odr"], $body["uid"], $note["product_id"], "apple", $note["transaction_id"], 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "success"; } else { echo "fail"; } function sendPostData($url, $data) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
include_once "log.php"; include_once "recharge.php"; include_once "ssl.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'pp_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $pf_info = $config["pp"][stripslashes($_POST["app_id"])]; $sign = base64_decode(stripslashes($_POST["sign"])); $source = json_decode(publickey_decodeing($sign, $pf_info["PubKey"]), true); if (empty($source) || $source["order_id"] != stripslashes($_POST["order_id"]) || $source["billno"] != stripslashes($_POST["billno"]) || $source["account"] != stripslashes($_POST["account"]) || $source["amount"] != stripslashes($_POST["amount"]) || $source["status"] != stripslashes($_POST["status"]) || $source["app_id"] != stripslashes($_POST["app_id"]) || $source["uuid"] != stripslashes($_POST["uuid"]) || $source["roleid"] != stripslashes($_POST["roleid"]) || $source["zone"] != stripslashes($_POST["zone"])) { log::instance()->error("ret: 签名无效"); echo "fail"; exit; } if ($source["status"] == 1) { log::instance()->error("ret: status 为已兑换过并成功返回"); echo "success"; exit; } $note = json_decode(base64_decode(stripslashes($_POST["roleid"])), true); $ret = recharge($pf_info["PF"], stripslashes($_POST["zone"]), stripslashes($_POST["billno"]), $note["uid"], $note["item"], stripslashes($_POST["amount"]), stripslashes($_POST["order_id"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "success"; } else { echo "fail"; }
include_once "log.php"; include_once "recharge.php"; include_once "ssl.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'itools_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $AppID = "533"; $pf_info = $config["itools"][$AppID]; // RSA verify $notify_data = base64_decode(stripslashes($_POST["notify_data"])); $notify_data = publickey_decodeing_sectionalized($notify_data, 128, $pf_info["PubKey"]); $sign = base64_decode(stripslashes($_POST["sign"])); if (!rsa_verify($notify_data, $sign, $pf_info["PubKey"])) { log::instance()->error("ret: 签名无效"); echo "fail"; exit; } // end verify echo "success"; $notify_data = json_decode($notify_data, true); if ($notify_data["result"] != "success") { log::instance()->error("ret: 支付失败"); exit; } $note = json_decode(base64_decode($notify_data["order_id_com"]), true); $ret = recharge($pf_info["PF"], $note["sid"], $note["odr"], $note["uid"], $note["item"], $notify_data["amount"], $notify_data["order_id"], 0); log::instance()->debug("ret: " . $ret);
include_once "log.php"; include_once "recharge.php"; include_once "ssl.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'wdj_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $AppID = "100013257"; $pf_info = $config["wdj"][$AppID]; // RSA verify $content = stripslashes($_POST["content"]); $sign = base64_decode(stripslashes($_POST["sign"])); $pem = chunk_split($pf_info["PubKey"], 64, "\n"); $pubkey = "-----BEGIN PUBLIC KEY-----\n" . $pem . "-----END PUBLIC KEY-----"; if (!rsa_verify($content, $sign, $pubkey)) { log::instance()->error("ret: 签名无效"); echo "fail"; exit; } // end verify $content = json_decode($content, true); $note = json_decode($content["out_trade_no"], true); $ret = recharge($pf_info["PF"], $note["sid"], $note["odr"], $note["uid"], $note["item"], $content["money"] / 100, $content["orderId"], 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "success"; } else { echo "fail"; }
include_once "recharge.php"; include_once "lx_tools/IappDecrypt.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'lx_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $transdata = stripslashes($_POST["transdata"]); $sign = stripslashes($_POST["sign"]); $data = json_decode($transdata, true); $pf_info = $config["lx"][$data["appid"]]; $tools = new IappDecrypt(); if ($tools->validsign($transdata, $sign, $pf_info["AppKey"]) != 0) { log::instance()->error("ret: 签名无效"); echo "FAILED"; exit; } if ($data["result"] != 0) { log::instance()->error("ret: 支付失败"); echo "SUCCESS"; exit; } list($trade_no, $sid, $uid, $item) = split(",", $data["cpprivate"]); $ret = recharge($pf_info["PF"], $sid, $data["exorderno"], $uid, $item, $data["money"] / 100, $data["transid"], 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "SUCCESS"; } else { echo "FAILED"; }
continue; } if (strlen($str) == 0) { $str = "{$key}=" . stripslashes($value); } else { $str .= "&{$key}=" . stripslashes($value); } } $sign = hash_hmac('sha1', $str, $pf_info["AppSec"]); if ($sign != stripslashes($_GET["signature"])) { log::instance()->error("ret: 签名无效"); echo "{\"errcode\":1525}"; exit; } if (stripslashes($_GET["orderStatus"]) != "TRADE_SUCCESS") { log::instance()->error("ret: 支付失败"); echo "{\"errcode\":200}"; exit; } $note = json_decode(stripslashes($_GET["cpUserInfo"]), true); $ret = recharge($pf_info["PF"], $note["sid"], stripslashes($_GET["cpOrderId"]), $note["uid"], $note["item"], stripslashes($_GET["payFee"]) / 100, stripslashes($_GET["orderId"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "{\"errcode\":200}"; } else { if ($ret == "ACCOUNT NOT EXIST") { echo "{\"errcode\":1516}"; } else { echo "{\"errcode\":3515,\"errMsg\":\"{$ret}\"}"; } }
$pay_cookie = array('session_id' => 'openid', 'session_type' => 'kp_actoken', 'org_loc' => '/mpay/pay_m'); $result = $openApi->api($pay_cookie['org_loc'], $pay_params, $pay_cookie, 'GET', 'https'); $result['msg'] = urlencode($result['msg']); $response = array('type' => 1, 'ret' => $result['ret']); if ($result['ret'] === 0) { log::instance()->debug("ret: 扣款成功 " . urldecode(json_encode($result))); $response['balance'] = $result['balance']; } else { log::instance()->error("ret: 扣款失败 " . urldecode(json_encode($result))); $response['err_code'] = $result['err_code']; echo json_encode($response); exit; } // 发钻石 $note = json_decode(stripslashes($params['appmeta']), true); $ret = recharge($pf_info["PF"], stripslashes($params["zoneid"]), $note["odr"], $note["uid"], $note["item"], $params["save_num"] / 10, $result["billno"], 0); log::instance()->debug("ret: " . $ret); if ($ret != "SUCCESS" && $ret != "TRADE_NO NOT EXIST") { // 退款 $pay_params = array('openid' => $params['openid'], 'openkey' => $params['openkey'], 'pay_token' => $params['pay_token'], 'ts' => time(), 'pf' => $params['pf'], 'zoneid' => $params['zoneid'], 'amt' => $params['save_num'], 'pfkey' => $params['pfkey'], 'billno' => $result['billno']); $pay_cookie = array('session_id' => 'openid', 'session_type' => 'kp_actoken', 'org_loc' => '/mpay/cancel_pay_m'); $result = $openApi->api($pay_cookie['org_loc'], $pay_params, $pay_cookie, 'GET', 'https'); $result['msg'] = urlencode($result['msg']); $response = array('type' => 2, 'ret' => $result['ret']); if ($result['ret'] === 0) { log::instance()->debug("ret: 退款成功 " . urldecode(json_encode($result))); } else { log::instance()->error("ret: 退款失败 " . urldecode(json_encode($result))); } } echo json_encode($response);
if ("POST" == $method) { $body = file_get_contents('php://input'); $params = $_POST; } } log::instance()->debug("new con: {$uri} {$body}"); $pf_info = $config["tencent"][stripslashes($params["appid"])]; $api = substr($uri, 0, strcspn($uri, '?')); if (!SnsSigCheck::verifySig($method, $api, $params, $pf_info["AppKey"] . '&', $params["sig"])) { log::instance()->error("ret: 签名无效"); $obj->ret = 4; $obj->msg = "签名无效"; echo json_encode($obj); exit; } $just_record = true; if ($just_record) { $ret = "SUCCESS"; } else { list($note, $t1, $t2) = split("\\*", stripslashes($params["appmeta"])); $note = json_decode(stripslashes($note), true); $ret = recharge($pf_info["PF"], stripslashes($params["zoneid"]), $note["odr"], $note["uid"], $note["item"], $params["amt"] / 100 + $params["payamt_coins"] / 10 + $params["pubacct_payamt_coins"] / 10, stripslashes($params["billno"]), 0); } log::instance()->debug("ret: " . $ret); $obj->ret = 4; $obj->msg = $ret; if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { $obj->ret = 0; $obj->msg = 'OK'; } echo json_encode($obj);
if (strlen($str) == 0) { $str = $key . "=" . stripslashes($value); } else { $str = $str . "&" . $key . "=" . stripslashes($value); } } $sign = base64_decode(stripslashes($_POST["sign"])); $pubkey = "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split($pf_info["PubKey"], 64, "\r\n") . "-----END PUBLIC KEY-----"; if (!rsa_verify($str, $sign, $pubkey)) { log::instance()->error("ret: 签名无效"); echo "{\"result\":1}"; exit; } // end verify if (stripslashes($_POST["result"]) != '0') { log::instance()->error("ret: 支付失败"); echo "{\"result\":0}"; exit; } $note = json_decode(stripslashes($_POST["extReserved"]), true); $ret = recharge($pf_info["PF"], $note["sid"], stripslashes($_POST["requestId"]), $note["uid"], $note["item"], stripslashes($_POST["amount"]), stripslashes($_POST["orderId"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "{\"result\":0}"; } else { if ($ret == "PARAM ERROR") { echo "{\"result\":98}"; } else { echo "{\"result\":99}"; } }
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'tbt_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $pf_info = $config["tb"][stripslashes($_GET["partner"])]; $str = "source=" . stripslashes($_GET["source"]) . "&trade_no=" . stripslashes($_GET["trade_no"]) . "&amount=" . stripslashes($_GET["amount"]) . "&partner=" . stripslashes($_GET["partner"]) . "&paydes=" . stripslashes($_GET["paydes"]) . "&debug=" . stripslashes($_GET["debug"]) . "&tborder=" . stripslashes($_GET["tborder"]) . "&key=" . $pf_info["AppKey"]; $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["sign"])) { log::instance()->error("ret: 签名无效"); exit; } $note = json_decode(stripslashes($_GET["paydes"]), true); $ret = recharge($pf_info["PF"], $note["sid"], stripslashes($_GET["trade_no"]), $note["uid"], $note["item"], stripslashes($_GET["amount"]) / 100, stripslashes($_GET["tborder"]), stripslashes($_GET["debug"])); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { $obj->status = 'success'; echo json_encode($obj); }
$str = $str . "&" . $key . "=" . stripslashes($value); } } $sign = base64_decode(stripslashes($_POST["sign"])); $pubkey = "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split($pf_info["PubKey"], 64, "\r\n") . "-----END PUBLIC KEY-----"; if (!rsa_verify($str, $sign, $pubkey)) { log::instance()->error("ret: 签名无效"); echo "failed"; exit; } // end verify parse_str(publickey_decodeing(base64_decode(stripslashes($_POST["notify_data"])), $pubkey), $notify_data); if ($notify_data["dealseq"] != stripslashes($_POST["dealseq"])) { log::instance()->error("ret: 数据不一致"); echo "failed"; exit; } if ($notify_data["payresult"] != 0) { log::instance()->error("ret: 支付失败"); echo "success"; exit; } // ky 不支持json串, 长度限制64 list($trade_no, $sid, $uid, $item) = split(",", $notify_data["dealseq"]); $ret = recharge($pf_info["PF"], $sid, $trade_no, $uid, $item, $notify_data["fee"], stripslashes($_POST["orderid"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "success"; } else { echo "failed"; }
log::init('./log', 'uc_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $body = json_decode(urldecode($body), true); if (!isset($body["data"])) { log::instance()->error("ret: 无效请求"); echo "FAILURE"; exit; } $pf_info = $config["uc"][$body["data"]["gameId"]]; ksort($body["data"]); $str = $pf_info["cpId"]; foreach ($body["data"] as $key => $value) { $str = "{$str}{$key}={$value}"; } $str = $str . $pf_info["AppKey"]; $sign = strtolower(md5($str)); if ($body["sign"] != $sign) { log::instance()->error("ret: 签名无效"); echo "FAILURE"; exit; } echo "SUCCESS"; if ($body["data"]["orderStatus"] == 'F') { log::instance()->error("ret: 支付失败"); exit; } $note = json_decode($body["data"]["callbackInfo"], true); $ret = recharge($pf_info["PF"], $note["sid"], $note["odr"], $note["uid"], $note["item"], $body["data"]["amount"], $body["data"]["orderId"], 0); log::instance()->debug("ret: " . $ret);
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'mzw_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $AppId = 111; $pf_info = $config[$AppId]; $str = stripslashes($_GET["appkey"]) . stripslashes($_GET["orderID"]) . stripslashes($_GET["productName"]) . stripslashes($_GET["productDesc"]) . stripslashes($_GET["productID"]) . stripslashes($_GET["money"]) . stripslashes($_GET["uid"]) . stripslashes($_GET["extern"]) . $pf_info["AppKey"]; $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["sign"])) { log::instance()->error("ret: 签名无效"); exit; } // 拇指玩无法发送json格式字串,encode了一下 $note = json_decode(base64_decode(stripslashes($_GET["extern"])), true); $ret = recharge($pf_info["PF"], $note["zoneId"], $note["trade_no"], stripslashes($_GET["username"]), stripslashes($_GET["productID"]), stripslashes($_GET["money"]), stripslashes($_GET["orderID"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { echo "SUCCESS"; }
include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'dk_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $AppId = "3491827"; $pf_info = $config["dk"][$AppId]; $str = stripslashes($_GET["amount"]) . stripslashes($_GET["cardtype"]) . stripslashes($_GET["orderid"]) . stripslashes($_GET["result"]) . stripslashes($_GET["timetamp"]) . $pf_info["AppKey"] . urlencode(stripslashes($_GET["aid"])); $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["client_secret"])) { log::instance()->error("ret: 签名无效"); echo "ERROR_SIGN"; exit; } if (stripslashes($_GET["result"]) == 2) { log::instance()->error("ret: 支付失败"); echo "SUCCESS"; exit; } $note = json_decode(stripslashes($_GET["aid"]), true); $ret = recharge($pf_info["PF"], $note["sid"], stripslashes($_GET["orderid"]), $note["uid"], $note["item"], stripslashes($_GET["amount"]), stripslashes($_GET["orderid"]), 0); log::instance()->debug("ret: " . $ret); if ($ret == "TRADE_NO NOT EXIST") { $ret = "ERROR_REPEAT"; } else { if ($ret != "SUCCESS") { $ret = "ERROR_FAIL"; } } echo $ret;
$config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', '91_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $pf_info = $config["91"][stripslashes($_GET["AppId"])]; $str = stripslashes($_GET["AppId"]) . stripslashes($_GET["Act"]) . stripslashes($_GET["ProductName"]) . stripslashes($_GET["ConsumeStreamId"]) . stripslashes($_GET["CooOrderSerial"]) . stripslashes($_GET["Uin"]) . stripslashes($_GET["GoodsId"]) . stripslashes($_GET["GoodsInfo"]) . stripslashes($_GET["GoodsCount"]) . stripslashes($_GET["OriginalMoney"]) . stripslashes($_GET["OrderMoney"]) . stripslashes($_GET["Note"]) . stripslashes($_GET["PayStatus"]) . stripslashes($_GET["CreateTime"]) . $pf_info["AppKey"]; $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["Sign"])) { log::instance()->error("ret: 签名无效"); $obj->ErrorCode = 5; $obj->ErrorDesc = "签名无效"; echo json_encode($obj); exit; } if (stripslashes($_GET["PayStatus"]) == 0) { log::instance()->error("ret: 支付失败"); $obj->ErrorCode = 1; $obj->ErrorDesc = "为什么失败还请求"; echo json_encode($obj); exit; } $note = json_decode(stripslashes($_GET["GoodsId"]), true); $ret = recharge($pf_info["PF"], $note["sid"], stripslashes($_GET["CooOrderSerial"]), $note["uid"], $note["item"], stripslashes($_GET["OrderMoney"]), stripslashes($_GET["ConsumeStreamId"]), 0); log::instance()->debug("ret: " . $ret); $obj->ErrorCode = 4; $obj->ErrorDesc = $ret; if ($ret == "SUCCESS" || $ret == "TRADE_NO NOT EXIST") { $obj->ErrorCode = 1; } echo json_encode($obj);