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}"); } }
/** * Record Exception +----------------------------------------- * @access public * @param Exception $e * @return void */ static function append($e) { // log $message = $e->getMessage() . ' File:' . $e->getFile() . ' Line:' . $e->getLine(); if (DEBUG) { debug::log($message, 'Warning'); $message .= "\n" . $e->getTraceAsString(); } $code = is_a($e, 'ErrorException') ? $e->getSeverity() : $e->getCode(); log::init()->write($message, $code, get_class($e)); self::$_exception[] = $e; }
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"; } }
<?php 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";
<?php 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);
<?php 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 {
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', '360_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $AppId = "201932111"; $pf_info = $config["360"][$AppId]; $param = $_GET; ksort($param); $str = ""; foreach ($param as $key => $value) { if ($key != "sign" && $key != "sign_return") { $str = $str . stripslashes($value) . "#"; } } $str = $str . $pf_info["AppSec"]; $sign = strtolower(md5($str)); if ($sign != stripslashes($_GET["sign"])) { log::instance()->error("ret: 签名无效"); exit; } echo "ok"; if (stripslashes($_GET["gateway_flag"]) != "success") { log::instance()->error("ret: 支付失败"); exit; } $note = json_decode(stripslashes($_GET["app_ext1"]), true);
<?php include_once "log.php"; 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";
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); 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') {
<?php include_once "log.php"; include_once "recharge.php"; include_once "tx_tools/SnsSigCheck.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'tencent_log'); $uri = $_SERVER['REQUEST_URI']; $method = strtoupper($_SERVER['REQUEST_METHOD']); if ("GET" == $method) { $params = $_GET; } else { 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";
<?php 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', 'hw_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $AppID = "10192320"; $pf_info = $config["hw"][$AppID]; // RSA verify $params = $_POST; ksort($params); $str = ""; foreach ($params as $key => $value) { if ($key == "sign") { continue; } 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: 签名无效");
<?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); }
<?php 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', 'ky_log'); $uri = $_SERVER['REQUEST_URI']; $body = file_get_contents('php://input'); log::instance()->debug("new con: {$uri} {$body}"); $AppID = "5183"; $pf_info = $config["ky"][$AppID]; // RSA verify $params = $_POST; ksort($params); $str = ""; foreach ($params as $key => $value) { if ($key == "sign") { continue; } 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: 签名无效");
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'mi_log'); $uri = $_SERVER['REQUEST_URI']; log::instance()->debug("new con: {$uri}"); $pf_info = $config["mi"][stripslashes($_GET["appId"])]; if (!isset($pf_info)) { log::instance()->error("ret: 找不到配置"); echo "{\"errcode\":1515}"; exit; } $param = $_GET; ksort($param); $str = ""; foreach ($param as $key => $value) { if ($key == "signature" || !isset($value)) { 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: 签名无效");
<?php include_once "log.php"; include_once "recharge.php"; include_once "tx_tools/OpenApiV3.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'qq_log'); $uri = $_SERVER['REQUEST_URI']; $method = strtoupper($_SERVER['REQUEST_METHOD']); if ("GET" == $method) { $params = $_GET; } else { if ("POST" == $method) { $body = file_get_contents('php://input'); $params = $_POST; } } log::instance()->debug("new con: {$uri} {$body}"); $appid = '1102506911'; $pf_info = $config["tencent"][$appid]; $openApi = new OpenApiV3($appid, $pf_info['AppKey']); $openApi->setServerName('openapi.tencentyun.com'); // 查询余额 $pay_params = array('openid' => $params['openid'], 'openkey' => $params['openkey'], 'pay_token' => $params['pay_token'], 'ts' => time(), 'pf' => $params['pf'], 'zoneid' => $params['zoneid'], 'pfkey' => $params['pfkey']); $pay_cookie = array('session_id' => 'openid', 'session_type' => 'kp_actoken', 'org_loc' => '/mpay/get_balance_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()->error("ret: 查询失败 " . urldecode(json_encode($result)));
<?php include_once "log.php"; include_once "recharge.php"; $config = (include "config.php"); header("Content-type: text/html; charset=utf-8"); log::init('./log', 'apple_log'); $uri = $_SERVER['REQUEST_URI']; $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)
<?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"; }
<?php include_once "log.php"; 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";
<?php include_once "log.php"; include_once "recharge.php"; $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;