This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
1,169 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
/** | ||
* PanDownload 网页复刻版,PHP 语言版API文件 | ||
* | ||
* 提供一些接口服务 | ||
* | ||
* @version 1.4.5 | ||
* | ||
* @author Yuan_Tuo <yuantuo666@gmail.com> | ||
* @link https://imwcr.cn/ | ||
* @link https://space.bilibili.com/88197958 | ||
* | ||
*/ | ||
session_start(); | ||
define('init', true); | ||
if (version_compare(PHP_VERSION, '7.0.0', '<')) { | ||
http_response_code(503); | ||
header('Content-Type: text/plain; charset=utf-8'); | ||
header('Refresh: 5;url=https://www.php.net/downloads.php'); | ||
die("HTTP 503 服务不可用!\r\nPHP 版本过低!无法正常运行程序!\r\n请安装 7.0.0 或以上版本的 PHP!\r\n将在五秒内跳转到 PHP 官方下载页面!"); | ||
} | ||
if (!(file_exists('config.php') && file_exists('functions.php'))) { | ||
http_response_code(503); | ||
header('Content-Type: text/plain; charset=utf-8'); | ||
header('Refresh: 5;url=https://github.com/yuantuo666/baiduwp-php'); | ||
die("HTTP 503 服务不可用!\r\n缺少相关配置和定义文件!无法正常运行程序!\r\n请重新 Clone 项目并配置!\r\n将在五秒内跳转到 GitHub 储存库!"); | ||
} | ||
// 导入配置和函数 | ||
require('config.php'); | ||
require('functions.php'); | ||
// 通用响应头 | ||
header('Content-Type: text/html; charset=utf-8'); | ||
header('X-UA-Compatible: IE=edge,chrome=1'); | ||
//隐藏错误代码,保护信息安全 | ||
if (DEBUG) { | ||
error_reporting(E_ALL); | ||
} else { | ||
error_reporting(0); //关闭错误报告 | ||
} | ||
|
||
$method = (!empty($_GET["m"])) ? $_GET["m"] : ""; | ||
switch ($method) { | ||
case 'LastParse': | ||
//返回数据库中上一次解析的时间,及SVIP状态 | ||
if (USING_DB) { | ||
//开启了数据库 | ||
connectdb(true); | ||
|
||
$sql = "SELECT * FROM `$dbtable` WHERE `size`>=52428800 ORDER BY `ptime` DESC LIMIT 0,1"; //时间倒序输出第一项 | ||
$mysql_query = mysqli_query($conn, $sql); | ||
if ($Result = mysqli_fetch_assoc($mysql_query)) { | ||
//存在数据 | ||
$Time = $Result["ptime"]; | ||
$realLink = $Result["realLink"]; | ||
$SvipState = (strstr('https://' . $realLink, "//qdall")) ? 0 : 1; //1:正常 0:限速 | ||
$SvipStateMsg = ($SvipState) ? "状态正常" : "已被限速"; | ||
$SvipTips = ($SvipState) ? "正常" : "限速"; | ||
EchoInfo(0, array( | ||
"msg" => "SVIP账号状态<br /><div align='left'>上次解析时间:" . $Time . "<br />上次解析状态:" . $SvipStateMsg . "</div>", | ||
"svipstate" => $SvipState, | ||
"sviptips" => $SvipTips | ||
)); | ||
} else { | ||
EchoInfo(0, array("msg" => "数据库中没有数据")); | ||
} | ||
} else { | ||
//未开启数据库 | ||
EchoInfo(-1, array("msg" => "未开启数据库功能", "sviptips" => "Unknown")); | ||
} | ||
break; | ||
|
||
case "ParseCount": | ||
//返回数据库中所有的解析总数和文件总大小 | ||
if (USING_DB) { | ||
//开启了数据库 | ||
connectdb(true); | ||
|
||
$sql = "SELECT count(`id`) as AllCount,sum(`size`) as AllSize FROM `$dbtable`"; | ||
$mysql_query = mysqli_query($conn, $sql); | ||
if ($Result = mysqli_fetch_assoc($mysql_query)) { | ||
//存在数据 | ||
$AllCount = $Result["AllCount"]; | ||
$AllSize = formatSize((int)$Result["AllSize"]); //格式化获取到的文件大小 | ||
$ParseCountMsg = "累计解析 $AllCount 个,共 $AllSize"; | ||
} else { | ||
EchoInfo(0, array("msg" => "当前数据库版本不支持此统计操作")); | ||
exit; | ||
} | ||
|
||
$sql = "SELECT count(`id`) as AllCount,sum(`size`) as AllSize FROM `$dbtable` WHERE date(`ptime`)=date(now());"; //获取今天的解析量 | ||
$mysql_query = mysqli_query($conn, $sql); | ||
if ($Result = mysqli_fetch_assoc($mysql_query)) { | ||
//存在数据 | ||
$AllCount = $Result["AllCount"]; | ||
$AllSize = formatSize((int)$Result["AllSize"]); //格式化获取到的文件大小 | ||
$TodayParseCountMsg = "今日解析 $AllCount 个,共 $AllSize"; | ||
} else { | ||
EchoInfo(0, array("msg" => "当前数据库版本不支持此统计操作")); | ||
exit; | ||
} | ||
EchoInfo(0, array("msg" => "系统使用统计<br /><div align='left'>$ParseCountMsg<br />$TodayParseCountMsg</div>")); | ||
} else { | ||
//未开启数据库 | ||
EchoInfo(-1, array("msg" => "未开启数据库功能")); | ||
} | ||
break; | ||
default: | ||
EchoInfo(-1, array("msg" => "无传入数据")); | ||
break; | ||
} | ||
|
||
function EchoInfo(int $error, array $Result) | ||
{ | ||
$ReturnArray = array("error" => $error); | ||
$ReturnArray += $Result; | ||
echo json_encode($ReturnArray); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
-- MySQL dump 10.13 Distrib 5.6.47, for Linux (x86_64) | ||
-- | ||
-- Host: localhost Database: bdwp | ||
-- ------------------------------------------------------ | ||
-- Server version 5.6.47-log | ||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!40101 SET NAMES utf8 */; | ||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
/*!40103 SET TIME_ZONE='+00:00' */; | ||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
|
||
-- | ||
-- Table structure for table `bdwp` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `bdwp`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `bdwp` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`userip` text NOT NULL COMMENT '用户ip', | ||
`filename` text NOT NULL COMMENT '文件名', | ||
`size` text NOT NULL COMMENT '文件大小', | ||
`md5` text NOT NULL COMMENT '文件效验码', | ||
`path` text NOT NULL COMMENT '文件路径', | ||
`server_ctime` text NOT NULL COMMENT '文件创建时间', | ||
`realLink` text NOT NULL COMMENT '文件下载地址', | ||
`ptime` datetime NOT NULL COMMENT '解析时间', | ||
`paccount` int(11) NOT NULL COMMENT '解析账号id', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=5050 DEFAULT CHARSET=utf8mb4; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Table structure for table `bdwp_ip` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `bdwp_ip`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `bdwp_ip` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`ip` text NOT NULL COMMENT 'ip地址', | ||
`remark` text NOT NULL COMMENT '备注', | ||
`add_time` datetime NOT NULL COMMENT '白黑名单添加时间', | ||
`type` tinyint(4) NOT NULL COMMENT '状态(0:允许,-1:禁止)', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Table structure for table `bdwp_svip` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `bdwp_svip`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `bdwp_svip` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`name` text NOT NULL COMMENT '账号名称', | ||
`svip_bduss` text NOT NULL COMMENT '会员bduss', | ||
`svip_stoken` text NOT NULL COMMENT '会员stoken', | ||
`add_time` datetime NOT NULL COMMENT '会员账号加入时间', | ||
`state` tinyint(4) NOT NULL COMMENT '会员状态(0:正常,-1:限速)', | ||
`is_using` datetime NOT NULL COMMENT '是否正在使用(非零表示真)', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=255 DEFAULT CHARSET=utf8; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | ||
|
||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | ||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | ||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | ||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | ||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | ||
|
||
-- Dump completed on 2020-10-20 23:21:53 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.