diff --git a/api.php b/api.php index 1366deb4..8db185fe 100644 --- a/api.php +++ b/api.php @@ -7,8 +7,7 @@ * 提供一些接口服务 * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ session_start(); @@ -80,10 +79,103 @@ EchoInfo(-1, array("msg" => "未登录")); exit; } + if (!USING_DB) { + EchoInfo(-1, array("msg" => "未启用数据库功能")); + exit; + } connectdb(); $action = (!empty($_GET["act"])) ? $_GET["act"] : ""; switch ($action) { + case "AccountStatus": + // 普通账号 + $return = ""; + $BDUSS = getSubstr(Cookie, 'BDUSS=', ';'); + $STOKEN = getSubstr(Cookie, 'STOKEN=', ';'); + $cache_key = md5($BDUSS); + if (isset($_SESSION['cache'][$cache_key]) && $_SESSION['cache'][$cache_key]['time'] > time() - 3600) { + $Status = $_SESSION['cache'][$cache_key]['data']; + } else { + $Status = AccountStatus($BDUSS, $STOKEN); + $_SESSION['cache'][$cache_key] = [ + 'time' => time(), + 'data' => $Status + ]; + } + if ($Status[0] == 0) { + //正常 + $AccountName = $Status[2]; + $return .= "账号名称:$AccountName
"; + if ($Status[3] == 1) + $return .= "登录状态:正常
"; + else + $return .= "登录状态:异常
"; + + $AccountVIP = ["普通账号", "普通会员", "超级会员"][$Status[1]]; + $return .= "会员状态:$AccountVIP
"; + if ($Status[4] != 0) { + $AccountTime = time2Units($Status[4]); + if ($Status[4] <= 60480) + $return .= "剩余时间:$AccountTime
"; + else + $return .= "剩余时间:$AccountTime
"; + } + } elseif ($Status[0] == -6) { + $return .= "id为 $id 的SVIP账号已经失效
"; + } else { + $return .= "出现位置错误代码:" . $Status[0] . "
"; + } + $normal_account_msg = $return; + $return = ""; + + // SVIP账号 + // 获取对应BDUSS + $DBSVIP = GetDBBDUSS(); + $SVIP_BDUSS = $DBSVIP[0]; + $id = $DBSVIP[1]; + $SVIP_STOKEN = $DBSVIP[2]; + if ($SVIP_STOKEN == "") { + $return .= "id为 $id 的SVIP账号没有设置对应STOKEN,无法检测
"; + } else { + $cache_key = md5($SVIP_BDUSS); + if (isset($_SESSION['cache'][$cache_key]) && $_SESSION['cache'][$cache_key]['time'] > time() - 3600) { + $Status = $_SESSION['cache'][$cache_key]['data']; + } else { + $Status = AccountStatus($SVIP_BDUSS, $SVIP_STOKEN); + $_SESSION['cache'][$cache_key] = [ + 'time' => time(), + 'data' => $Status + ]; + } + if ($Status[0] == 0) { + $AccountName = $Status[2]; + $return .= "账号名称:$AccountName
"; + if ($Status[3] == 1) + $return .= "登录状态:正常
"; + else + $return .= "登录状态:异常
"; + + $AccountVIP = ["普通账号", "普通会员", "超级会员"][$Status[1]]; + $return .= "会员状态:$AccountVIP
"; + if ($Status[4] != 0) { + $AccountTime = time2Units($Status[4]); + if ($Status[4] <= 60480) + $return .= "剩余时间:$AccountTime
"; + else + $return .= "剩余时间:$AccountTime
"; + } + } elseif ($Status[0] == -6) { + $return .= "id为 $id 的SVIP账号已经失效
"; + } else { + $return .= "出现位置错误代码:" . $Status[0] . "
"; + } + } + + $svip_account_msg = $return; + header('Content-Type: application/json; charset=utf-8'); + echo json_encode(array("error" => 0, "normal_msg" => $normal_account_msg, "svip_msg" => $svip_account_msg)); + break; + case "AnalyseGetTable": $page = (!empty($_GET["page"])) ? $_GET["page"] : ""; header('Content-Type: text/html; charset=utf-8'); diff --git a/common/Parse.php b/common/Parse.php index 515d586f..0fd2609d 100644 --- a/common/Parse.php +++ b/common/Parse.php @@ -4,8 +4,7 @@ * PanDownload 网页复刻版,PHP 语言版 * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php */ class Parse { diff --git a/common/functions.php b/common/functions.php index 556ecac4..522ea0c5 100644 --- a/common/functions.php +++ b/common/functions.php @@ -8,8 +8,7 @@ * 请勿随意修改此文件!如需更改相关配置请到 config.php ! * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ if (!init) require_once("./common/invalidCheck.php"); diff --git a/common/index.php b/common/index.php index a715817b..4f20e566 100644 --- a/common/index.php +++ b/common/index.php @@ -6,8 +6,7 @@ * 首页文件 * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ require_once("./common/invalidCheck.php"); diff --git a/common/invalidCheck.php b/common/invalidCheck.php index 6c85d2d3..1a61dcf7 100644 --- a/common/invalidCheck.php +++ b/common/invalidCheck.php @@ -6,8 +6,7 @@ * 检查是否初始化 * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ if (!defined('init')) { // 直接访问处理程序 diff --git a/common/language.php b/common/language.php index c54dfbaa..41d505ff 100644 --- a/common/language.php +++ b/common/language.php @@ -5,11 +5,8 @@ * * 功能描述:为一些页面添加必要的语言翻译 * - * 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php - * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ require_once("./common/invalidCheck.php"); diff --git a/docs/API.md b/docs/API.md index 6376c3e4..cafd12a5 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,6 +1,6 @@ # baiduwp-php -> v3.0.1 +> v3.0.2 Base URLs: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1433b69c..f3dd4352 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,4 +1,17 @@ # Update +### `3.0.2` 版本: +- 更新日期:2023-04-07 +- 修改内容: + - ⚠错误修复 + - 修复限速账号检查 + - 修复不安全网站无法复制下载地址 + - 修复后台无法获取SVIP账号状态 + - ♻代码优化 + - 改进后台管理错误提示 + - 改进翻译函数 + - 后端账号状态分离至API接口 + - 代码中版权信息改为项目地址 + ### `3.0.1` 版本: - 更新日期:2023-04-05 - 修改内容: diff --git a/index.php b/index.php index 03bd8941..abf35714 100644 --- a/index.php +++ b/index.php @@ -5,16 +5,11 @@ * * 功能描述:使用百度 SVIP 账号获取真实下载地址,与 Pandownload 原版无关。 * - * 希望在使用时能够保留导航栏的 Github 感谢! - * - * 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php - * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ -$programVersion_Index = "3.0.1"; +$programVersion_Index = "3.0.2"; session_start(); define('init', true); if (!file_exists('./common/invalidCheck.php')) { diff --git a/install.php b/install.php index c58c77af..3d031c37 100644 --- a/install.php +++ b/install.php @@ -5,12 +5,8 @@ * * 功能描述:安装PanDownload 网页复刻版 * - * 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php - * - * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ define('init', true); diff --git a/install/config_raw b/install/config_raw index 52808cc8..7329bd85 100644 --- a/install/config_raw +++ b/install/config_raw @@ -4,12 +4,11 @@ * !!!请勿修改本文件,如果手动修改后再在后台设置,可能导致config.php文件被清空!!! * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php */ require_once "./common/invalidCheck.php"; -const programVersion = '3.0.1'; +const programVersion = '3.0.2'; const Sitename = ''; const Cookie = ''; diff --git a/settings.php b/settings.php index 06031761..530d9295 100644 --- a/settings.php +++ b/settings.php @@ -6,9 +6,7 @@ * 设置及后台功能 * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 - * + * @link https://github.com/yuantuo666/baiduwp-php */ session_start(); define('init', true); @@ -513,99 +511,30 @@ function IPLoadmore() {
普通账号状态
-

- time() - 3600) { - $Status = $_SESSION['cache'][$cache_key]['data']; - } else { - $Status = AccountStatus($BDUSS, $STOKEN); - $_SESSION['cache'][$cache_key] = [ - 'time' => time(), - 'data' => $Status - ]; - } - if ($Status[0] == 0) { - //正常 - $AccountName = $Status[2]; - echo "账号名称:$AccountName
"; - if ($Status[3] == 1) - echo "登录状态:正常
"; - else - echo "登录状态:异常
"; - - $AccountVIP = ["普通账号", "普通会员", "超级会员"][$Status[1]]; - echo "会员状态:$AccountVIP
"; - if ($Status[4] != 0) { - $AccountTime = time2Units($Status[4]); - if ($Status[4] <= 60480) - echo "剩余时间:$AccountTime
"; - else - echo "剩余时间:$AccountTime
"; - } - } elseif ($Status[0] == -6) { - echo "id为 $id 的SVIP账号已经失效
"; - } else { - echo "出现位置错误代码:" . $Status[0] . "
"; - } - ?> +

+ 正在获取账号状态...


会员账号状态
-

- "; - } else { - $cache_key = md5($SVIP_BDUSS); - if (isset($_SESSION['cache'][$cache_key]) && $_SESSION['cache'][$cache_key]['time'] > time() - 3600) { - $Status = $_SESSION['cache'][$cache_key]['data']; - } else { - $Status = AccountStatus($SVIP_BDUSS, $SVIP_STOKEN); - $_SESSION['cache'][$cache_key] = [ - 'time' => time(), - 'data' => $Status - ]; - } - if ($Status[0] == 0) { - $AccountName = $Status[2]; - echo "账号名称:$AccountName
"; - if ($Status[3] == 1) - echo "登录状态:正常
"; - else - echo "登录状态:异常
"; - - $AccountVIP = ["普通账号", "普通会员", "超级会员"][$Status[1]]; - echo "会员状态:$AccountVIP
"; - if ($Status[4] != 0) { - $AccountTime = time2Units($Status[4]); - if ($Status[4] <= 60480) - echo "剩余时间:$AccountTime
"; - else - echo "剩余时间:$AccountTime
"; - } - } elseif ($Status[0] == -6) { - echo "id为 $id 的SVIP账号已经失效
"; - } else { - echo "出现位置错误代码:" . $Status[0] . "
"; - } - } - ?> +

+ 正在获取账号状态...


+ diff --git a/static/functions.js b/static/functions.js index 8bd94b73..a40f539c 100644 --- a/static/functions.js +++ b/static/functions.js @@ -4,8 +4,7 @@ * 许多函数来源于github,详见项目里的Thanks * * @author Yuan_Tuo - * @link https://imwcr.cn/ - * @link https://space.bilibili.com/88197958 + * @link https://github.com/yuantuo666/baiduwp-php * */ addEventListener('DOMContentLoaded', function () {