This commit is contained in:
Bigsk 2021-02-07 22:28:02 +08:00
parent 25b30c420a
commit 3918b75874
4 changed files with 50 additions and 33 deletions

View File

@ -7,8 +7,9 @@ $stream_opts = [
] ]
]; ];
if($_GET['date'] == null){ if($_GET['date'] == null){
header("Content-type:application/json"); header('HTTP/1.1 400 Bad Request');
echo '{"error":"10001"}'; header('status: 400 Bad Request');
echo '{"error":"400"}';
}else{ }else{
echo @file_get_contents("http://tool.bitefu.net/jiari/?d=".$_GET['date'],false, stream_context_create($stream_opts)); echo @file_get_contents("http://tool.bitefu.net/jiari/?d=".$_GET['date'],false, stream_context_create($stream_opts));
} }

37
fah/json/api.php Normal file
View File

@ -0,0 +1,37 @@
<?php
header("Content-type:application/json;charset=utf-8");
$stream_opts = [
"ssl" => [
"verify_peer"=>false,
"verify_peer_name"=>false,
]
];
$error = null;
if($_GET['donor'] == null){
if($_GET['team'] == '*'){
echo @file_get_contents("http://reverse.ghink.net/fah.php?team=*",false, stream_context_create($stream_opts));
}else{
echo @file_get_contents("http://reverse.ghink.net/fah.php?team=".$_GET['team'],false, stream_context_create($stream_opts));
}
}else{
if($_GET['team'] == null){
}else{
header('HTTP/1.1 400 Bad Request');
header('status: 400 Bad Request');
echo '{"error":"400"}';
}
}
if($_GET['team'] == null){
if($_GET['donor'] == '*'){
echo @file_get_contents("http://reverse.ghink.net/fah.php?donor=*",false, stream_context_create($stream_opts));
}else{
echo @file_get_contents("http://reverse.ghink.net/fah.php?donor=".$_GET['donor'],false, stream_context_create($stream_opts));
}
}else{
if($_GET['donor'] == null){
}else{
header('HTTP/1.1 400 Bad Request');
header('status: 400 Bad Request');
echo '{"error":"400"}';
}
}

View File

@ -1,38 +1,15 @@
<?php <?php
header("Content-type:application/json;charset=utf-8"); header("Content-type:application/json;charset=utf-8");
function is_url_alive(){
$opts = array(
'http'=>array(
'timeout'=>3,
)
);
$context = stream_context_create($opts);
return @file_get_contents("http://whois.pconline.com.cn/ipJson.jsp", false, $context);
}
if(empty($_GET['ip'])){ if(empty($_GET['ip'])){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR']; $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{ }else{
$ip=$_GET['ip']; $ip=$_GET['ip'];
} }
$db=mysqli_connect("database.ghink.net","ghinkapi","ghink2014","ghinkapi");
mysqli_query($db,"set names utf8"); $ipinfo=@file_get_contents("http://whois.pconline.com.cn/ipJson.jsp?ip=".$ip."&json=true");
$result=mysqli_query($db,"SELECT `ip` FROM `ip_area` WHERE `ip`='".$ip."'"); $ipinfo=iconv("GB2312","UTF-8",$ipinfo);
if(empty(mysqli_fetch_array($result))){ $ipinfo=json_decode($ipinfo);
if(is_url_alive()){ foreach($ipinfo as $ii=>$ii2){
$ipinfo=@file_get_contents("http://whois.pconline.com.cn/ipJson.jsp?ip=".$ip."&json=true"); $$ii = $ii2;
$ipinfo=iconv("GB2312","UTF-8",$ipinfo);
$ipinfo=json_decode($ipinfo);
foreach($ipinfo as $ii=>$ii2){
$$ii = $ii2;
}
echo '{"ip":"'.$ip.'","pro":"'.$pro.'","city":"'.$city.'","addr":"'.trim($addr).'"}';
mysqli_query($db,"INSERT INTO `ip_area` (`ip`, `pro`, `city`, `addr`, `last_update`) VALUES ('".$ip."', '".$pro."', '".$city."', '".trim($addr)."', '".time()."')");
}else{
echo '{"error":"10002"}';
}
}else{
$result=mysqli_query($db,"SELECT * FROM `ip_area` WHERE `ip`='".$ip."'");
$result=mysqli_fetch_array($result);
echo '{"ip":"'.$result['ip'].'","pro":"'.$result['pro'].'","city":"'.$result['city'].'","addr":"'.$result['addr'].'"}';
} }
mysqli_close($db); echo '{"ip":"'.$ip.'","pro":"'.$pro.'","city":"'.$city.'","addr":"'.trim($addr).'"}';

View File

@ -4,7 +4,9 @@ function decodeUnicode($str){
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return iconv("UCS-2BE","UTF-8",pack("H*", $matches[1]));'), $str); return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return iconv("UCS-2BE","UTF-8",pack("H*", $matches[1]));'), $str);
} }
if($_GET['roomid']==null){ if($_GET['roomid']==null){
echo '{"error":"10001"}'; header('HTTP/1.1 400 Bad Request');
header('status: 400 Bad Request');
echo '{"error":"400"}';
}else{ }else{
$json=@decodeUnicode(@file_get_contents("https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomPlayInfo?room_id=".$_GET['roomid']."&play_url=1&mask=1&qn=0&platform=web")); $json=@decodeUnicode(@file_get_contents("https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomPlayInfo?room_id=".$_GET['roomid']."&play_url=1&mask=1&qn=0&platform=web"));
if($_GET['mode']=="easy"){ if($_GET['mode']=="easy"){