bt 开心
2021-03-10 / 收藏夹 / 1362 次围观 / 0 次吐槽 /JavaScript
location /api {
proxy_pass http://127.0.0.1;
proxy_set_header Host $host;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
add_header Cache-Control no-cache;
expires 12h;
}
location ~ ^/(api/Plugin/check_plugin_status|api/panel/get_soft_list|api/panel/notpro|api/panel/plugin_total|api/panel/get_soft_list_test|api/cloudtro/get_product_order_status|api/coll/get_coll_plugin_list) {
try_files $uri $uri/ /bt.php?$query_string&uri=$uri;
}
PHP
<?php
# 未设置请求参数不给请求
if(!isset($_GET['uri']) || $_SERVER["REMOTE_ADDR"] != "127.0.0.1"){
die("BT crack server 1.2");
}
if (!function_exists('getallheaders'))
{
function getallheaders()
{
$headers = [];
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
$base_url = 'http://127.0.0.1';
foreach (getallheaders() as $key => $value) {
if($key == "Accept-Encoding"){
continue;
}
$httpHeader[] = $key . ": " . $value;
}
// # 记录请求
// $myfile = fopen("newfile.txt", "a") or die("Unable to open file!");
// $txt = "[GET]" . http_build_query($_GET,'',', ') . "\n";
// fwrite($myfile, $txt);
// $txt = "[POST]" . http_build_query($_POST,'',', ') . "\n";
// fwrite($myfile, $txt);
// $txt = "[HEADERS]" . http_build_query($httpHeader,'',', ') . "\n";
// fwrite($myfile, $txt);
// fclose($myfile);
# 判断GET参数
if($_GET['uri'] == "/api/panel/get_soft_list" || $_GET['uri'] == "/api/panel/get_soft_list_test") {
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $base_url . $_GET['uri']);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
// $output contains the output string
$output = curl_exec($ch);
$output = json_decode($output, true);
foreach ($output['list'] as $key => &$value) {
# 付费插件全部到期日期修改
if(floatval($value['pid']) < 600000000){
$value['endtime'] = 2493043200;
}
}
$output['pro'] = 0;
$output['ltd'] = 2493043200;
// 返回JSON_ENCODE
echo(json_encode($output));
// close curl resource to free up system resources
curl_close($ch);
}elseif ($_GET['uri'] == "/api/Plugin/check_plugin_status") {
$output['status'] = true;
// 返回JSON_ENCODE
echo(json_encode($output));
}elseif ($_GET['uri'] == "/api/panel/plugin_total"){
echo("1");
}elseif ($_GET['uri'] == "/api/coll/get_coll_plugin_list"){
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $base_url . $_GET['uri']);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
// $output contains the output string
$output = curl_exec($ch);
$output = json_decode($output, true);
// $output['num'] = 99999;
// $output['endtime'] = 253402185600;
// # 记录请求
// $myfile = fopen("newfile.txt", "a") or die("Unable to open file!");
// $txt = "[DATA]" . json_encode($output) . "\n";
// fwrite($myfile, $txt);
// fclose($myfile);
// 返回JSON_ENCODE
echo(json_encode($output));
// close curl resource to free up system resources
curl_close($ch);
}elseif ($_GET['uri'] == "/api/cloudtro/get_product_order_status"){
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $base_url . $_GET['uri']);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
// $output contains the output string
$output = curl_exec($ch);
$output = json_decode($output, true);
if($_POST['uid'] != 0){
$output['status'] = true;
$output['msg'] = [];
$output['msg']['endtime'] = 2493043200;
$output['msg']['num'] = 99999;
}
// # 记录请求
// $myfile = fopen("newfile.txt", "a") or die("Unable to open file!");
// $txt = "[DATA]" . json_encode($output) . "\n";
// fwrite($myfile, $txt);
// fclose($myfile);
// 返回JSON_ENCODE
echo(json_encode($output));
// close curl resource to free up system resources
curl_close($ch);
}
- 上一篇:IIS创建FTP服务
- 下一篇:狂雨CMS手机模板
Powered By Cheug's Blog
Copyright Cheug Rights Reserved.