commit
f9bb9d3ddb
Binary file not shown.
Binary file not shown.
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// 防止外部破解
|
||||
if(!defined('SYSTEM')){
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
|
||||
if (BLOCK_TYPE=="none"){ // 无鉴权模式
|
||||
// pass
|
||||
}else if (ACCESS_KEY != ""){ // access_key 存在
|
||||
if (BLOCK_TYPE == "blacklist"){ // 黑名单鉴权
|
||||
$url = "https://black.qimo.ink/?access_key=".ACCESS_KEY;
|
||||
$out = get_webpage($url);
|
||||
// 如果是黑名单
|
||||
if ($out=="ban" || $baned == 1){
|
||||
if (REPLACE_TYPE=="hlw" || REPLACE_TYPE=="tom" || REPLACE_TYPE=="xyy" || REPLACE_TYPE=="404"){ // 替换成葫芦娃、猫和老鼠、喜羊羊、肥肠抱歉
|
||||
include ("replace.php");
|
||||
replace();
|
||||
}else {
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
}
|
||||
}else if (BLOCK_TYPE == "whitelist"){ // 白名单鉴权
|
||||
if (SAVE_CACHE==1){ // 是否开启缓存
|
||||
$uid = get_uid_fromsql(); // 从数据库获取
|
||||
}else{
|
||||
$uid = get_uid(); // 从API获取
|
||||
}
|
||||
// 是否在白名单内
|
||||
if (!in_array($uid, $WHITELIST) || $baned == 1) {
|
||||
if (REPLACE_TYPE=="hlw" || REPLACE_TYPE=="tom" || REPLACE_TYPE=="xyy" || REPLACE_TYPE=="404"){ // 替换成葫芦娃、猫和老鼠、喜羊羊、肥肠抱歉
|
||||
include ("replace.php");
|
||||
replace();
|
||||
}else {
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{ // access_key 不存在
|
||||
if (BLOCK_TYPE == "whitelist" || NEED_LOGIN == 1){ // 白名单模式 或 黑名单模式+需要登录
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_uid(){
|
||||
$sign = md5("access_key=".ACCESS_KEY."&appkey=".APPKEY."&ts=".TS.APPSEC);
|
||||
$url = "https://app.bilibili.com/x/v2/account/myinfo?access_key=".ACCESS_KEY."&appkey=".APPKEY."&ts=".TS."&sign=".$sign;
|
||||
$output = get_webpage($url);
|
||||
$array = json_decode($output, true);
|
||||
$code = $array['code'];
|
||||
if ($code=="0"){
|
||||
$uid = $array['data']['mid'];
|
||||
}else{
|
||||
$uid = "0";
|
||||
}
|
||||
return $uid;
|
||||
}
|
||||
|
||||
function get_uid_fromsql(){
|
||||
global $dbh;
|
||||
$sqlco = "SELECT `uid` FROM `keys` WHERE `access_key` = '".ACCESS_KEY."'";
|
||||
$cres = $dbh -> query($sqlco);
|
||||
$vnum = $cres -> fetch();
|
||||
$uid = $vnum['uid'];
|
||||
return $uid;
|
||||
}
|
||||
|
||||
?>
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
// 防止外部破解
|
||||
if(!defined('SYSTEM')){
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
|
||||
if (ACCESS_KEY != ""){ // access_key 是否存在
|
||||
$url = "https://black.qimo.ink/?access_key=".ACCESS_KEY;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch,CURLOPT_URL,$url);
|
||||
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
|
||||
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
|
||||
$out = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
// 如果是黑名单
|
||||
if ($out=="ban" || $baned == 1){
|
||||
if (REPLACE_TYPE=="hlw" || REPLACE_TYPE=="tom" || REPLACE_TYPE=="xyy" || REPLACE_TYPE=="404"){ // 替换成葫芦娃、猫和老鼠、喜羊羊、肥肠抱歉
|
||||
include ("replace.php");
|
||||
replace();
|
||||
}else {
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
}
|
||||
}else if (NEED_LOGIN == 1){
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
?>
|
@ -1,54 +0,0 @@
|
||||
<?php
|
||||
// 防止外部破解
|
||||
if(!defined('SYSTEM')){
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
|
||||
if (ACCESS_KEY != ""){ // access_key 是否存在
|
||||
if (SAVE_CACHE==1){ // 是否开启缓存
|
||||
$uid = get_uid_fromsql(); // 从数据库获取
|
||||
}else{
|
||||
$uid = get_uid(); // 从API获取
|
||||
}
|
||||
// 是否在白名单内
|
||||
if (!in_array($uid, $WHITELIST) || $baned == 1) {
|
||||
if (REPLACE_TYPE=="hlw" || REPLACE_TYPE=="tom" || REPLACE_TYPE=="xyy" || REPLACE_TYPE=="404"){ // 替换成葫芦娃、猫和老鼠、喜羊羊、肥肠抱歉
|
||||
include ("replace.php");
|
||||
replace();
|
||||
}else {
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
exit(BLOCK_RETURN);
|
||||
}
|
||||
|
||||
function get_uid(){
|
||||
$sign = md5("access_key=".ACCESS_KEY."&appkey=".APPKEY."&ts=".TS.APPSEC);
|
||||
$testurl = "https://app.bilibili.com/x/v2/account/myinfo?access_key=".ACCESS_KEY."&appkey=".APPKEY."&ts=".TS."&sign=".$sign;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $testurl);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$array = json_decode($output, true);
|
||||
$code = $array['code'];
|
||||
if ($code=="0"){
|
||||
$uid = $array['data']['mid'];
|
||||
}else{
|
||||
$uid = "0";
|
||||
}
|
||||
return $uid;
|
||||
}
|
||||
|
||||
function get_uid_fromsql(){
|
||||
global $dbh;
|
||||
$sqlco = "SELECT `uid` FROM `keys` WHERE `access_key` = '".ACCESS_KEY."'";
|
||||
$cres = $dbh -> query($sqlco);
|
||||
$vnum = $cres -> fetch();
|
||||
$uid = $vnum['uid'];
|
||||
return $uid;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue