├── resource
├── bg.png
├── logo.png
├── favicon.ico
└── UserAgentSwitcher.crx
├── static
├── ready.js
├── index.css
└── functions.js
├── README.md
├── config.php
├── README.original.md
├── functions.php
├── index.php
└── LICENSE
/resource/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lc6464/PanDownload-PHP-Optimized/HEAD/resource/bg.png
--------------------------------------------------------------------------------
/resource/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lc6464/PanDownload-PHP-Optimized/HEAD/resource/logo.png
--------------------------------------------------------------------------------
/resource/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lc6464/PanDownload-PHP-Optimized/HEAD/resource/favicon.ico
--------------------------------------------------------------------------------
/resource/UserAgentSwitcher.crx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lc6464/PanDownload-PHP-Optimized/HEAD/resource/UserAgentSwitcher.crx
--------------------------------------------------------------------------------
/static/ready.js:
--------------------------------------------------------------------------------
1 | $(".fa-file").each(function() {
2 | var icon = getIconClass($(this).next().text());
3 | if (icon !== "") {
4 | if ($.inArray(icon, ['fa-windows', 'fa-android', 'fa-apple']) >= 0) $(this).removeClass("far").addClass("fab");
5 | $(this).removeClass("fa-file").addClass(icon);
6 | }
7 | });
--------------------------------------------------------------------------------
/static/index.css:
--------------------------------------------------------------------------------
1 | body { background: url("../resource/bg.png"); }
2 | .logo-img { width: 1.1em; position: relative; top: -3px; }
3 | .form-inline input { width: 500px; }
4 | .input-card { position: relative; top: 7.0em; }
5 | .card-header { height: 3.2em; font-size: 20px; line-height: 2.0em; }
6 | .card-text { word-wrap: break-word; }
7 | form input, form button { height: 3em; }
8 | .alert { position: relative; top: 5em; }
9 | .alert-heading { height: 0.8em; }
10 | .anchor { vertical-align: top; }
11 | .anchor + h4 { display: inline-block; margin-left: 0.4rem; }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 存档声明
2 |
3 | ### 此储存库将要被设为存档(只读)储存库
4 |
5 | > [此项目](https://github.com/lc6464/PanDownload-PHP-Optimized)是由 [lc6464/baiduwp-php](https://github.com/lc6464/baiduwp-php) 发展而来,
6 | > [lc6464/baiduwp-php](https://github.com/lc6464/baiduwp-php) 又是由 [yuantuo666/baiduwp-php](https://github.com/yuantuo666/baiduwp-php) 复刻而来,
7 | > 如今,[此项目](https://github.com/lc6464/PanDownload-PHP-Optimized)和 [lc6464/baiduwp-php](https://github.com/lc6464/baiduwp-php) 都已经很久没有更新,
8 | > 由于学习压力以及其他项目,我无力也不想再更新这个项目了。
9 |
10 | 感谢各位的支持,于**2021年2月7日20时**起,此储存库将被存档。
11 | [lc6464/baiduwp-php](https://github.com/lc6464/baiduwp-php) 暂时不会被存档,将用于向[复刻源](https://github.com/yuantuo666/baiduwp-php)提交拉取请求(如果有必要的话)。
12 | 再次感谢各位的支持。
13 |
14 | > 此项目启动于2020年,最后一次**代码更新**也是在2020年。
15 | > 此项目由 [LC](https://github.com/lc6464) 制作。
16 | > Copyright © 2020-2021 LC. All rights reserved.
17 | > 2021-2-7 19:55 记。
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 |
18 | * @link https://imwcr.cn/
19 | * @link https://space.bilibili.com/88197958
20 | *
21 | * @author LC
22 | * @link https://lcwebsite.cn/
23 | * @link https://space.bilibili.com/52618445
24 | */
25 | define('programVersion', '1.3.5');
26 | if (!defined('init')){ // 直接访问处理程序
27 | http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./');
28 | die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的配置文件!\r\n禁止直接访问!");
29 | }
30 |
31 | define('BDUSS', ''); // 你的 SVIP BDUSS
32 | define('STOKEN', ''); // 你的 SVIP STOKEN
33 | define('IsCheckPassword', true); // 设为 true 则要求密码为变量 Password 的值,否则提示密码错误;设为 false 则不需要密码。
34 | define('Password', '请在这里填写密码啦!ヾ(≧▽≦*)o'); // 在下载器首页需要输入的密码,如果将 IsCheckPassWord 设为 false 则无论设置什么都会失效。
--------------------------------------------------------------------------------
/README.original.md:
--------------------------------------------------------------------------------
1 | # baiduwp-php
2 | PanDownload 网页复刻版,PHP 语言版
3 | 本项目是依据 [baiduwp-php](https://github.com/yuantuo666/baiduwp-php "baiduwp-php") 优化而来,仅供大家学习参考
4 | 希望在使用时能够保留导航栏的 Made by Yuan_Tuo 和 Optimized by LC,感谢!
5 | - 原作者 [Yuan_Tuo](https://github.com/yuantuo666 "Yuantuo")
6 | - 由 [LC](https://github.com/lc6464 "LC") 优化
7 |
8 | ## Demo
9 | [已加密,暂不开放!](https://imwcr.cn/api/bdwp/)
10 |
11 | ## 安装注意事项
12 | - 使用了 `SESSION`,注意 **PHP 访问系统文件(夹)权限**问题
13 | - 仅支持 **PHP 7 和 7+**!
14 |
15 | ## Setting
16 | 请在 `config.php` 中找:
17 | ```
18 | define('BDUSS', '');
19 | define('STOKEN', '');
20 | define('IsCheckPassword', true);
21 | define('Password', '请在这里填写密码啦!ヾ(≧▽≦*)o');
22 | ```
23 | - 前两项填入你自己的 SVIP 信息就行,获取 cookie 方法见视频 [BV1Yh411d7Gd](https://www.bilibili.com/video/BV1Yh411d7Gd)
24 | - 第三项是是否需要密码的选项
25 | - 第四项是首页需要输入的密码,但是如果第三项为 `false` 则无效
26 | - 详细信息可见 `config.php` 的注释
27 |
28 | ## Thanks
29 | - [baiduwp JavaScript 版](https://github.com/TkzcM/baiduwp "GitHub 项目")
30 | - [baiduwp PHP 版](https://github.com/yuantuo666/baiduwp-php "GitHub 项目")
31 | - [PanDownload 网站](https://pandownload.com/ "PanDownload 网站")
32 | - [KinhDown 客户端](https://t.me/kinhdown/ "KinhDown 客户端")
33 | - [PNL 下载方式](https://www.lanzous.com/u/pnl "PNL 下载方式")
34 |
35 | ## New Changes
36 | - 当前版本:`1.3.5`
37 | - 更新日期:2020-8-17
38 | - 优化后端逻辑和效率
39 | - 优化代码
40 | - 优化错误时提示
41 | - 修复浏览器中点击下载链接,传递 Referer 导致概率性出错的问题
42 |
43 | ## 坑或不确定
44 | - `static/functions.js`
45 | - 42 行
--------------------------------------------------------------------------------
/static/functions.js:
--------------------------------------------------------------------------------
1 | function validateForm() {
2 | var link = document.forms["form1"]["surl"].value;
3 | if (link == null || link === "") { document.forms["form1"]["surl"].focus(); return false; }
4 | var uk = link.match(/uk=(\d+)/), shareid = link.match(/shareid=(\d+)/);
5 | if (uk != null && shareid != null) {
6 | document.forms["form1"]["surl"].value = "";
7 | $("form").append(``);
8 | return true;
9 | }
10 | var surl = link.match(/surl=([A-Za-z0-9-_]+)/);
11 | if (surl == null) {
12 | surl = link.match(/1[A-Za-z0-9-_]+/);
13 | if (surl == null) {
14 | document.forms["form1"]["surl"].focus(); return false;
15 | } else surl = surl[0];
16 | } else surl = "1" + surl[1];
17 | document.forms["form1"]["surl"].value = surl;
18 | return true;
19 | }
20 | function dl(fs_id, timestamp, sign, randsk, share_id, uk) {
21 | var form = $('');
22 | form.append(`
23 | `);
24 | $(document.body).append(form); form.submit();
25 | }
26 | function OpenDir(path, pwd, share_id, uk, surl) {
27 | var form = $('');
28 | form.append(`
29 | `);
30 | $(document.body).append(form); form.submit();
31 | }
32 | function getIconClass(filename) {
33 | var filetype = {
34 | file_video: ["wmv", "rmvb", "mpeg4", "mpeg2", "flv", "avi", "3gp", "mpga", "qt", "rm", "wmz", "wmd", "wvx", "wmx", "wm", "mpg", "mp4", "mkv", "mpeg", "mov", "asf", "m4v", "m3u8", "swf"],
35 | file_audio: ["wma", "wav", "mp3", "aac", "ra", "ram", "mp2", "ogg", "aif", "mpega", "amr", "mid", "midi", "m4a", "flac"],
36 | file_image: ["jpg", "jpeg", "gif", "bmp", "png", "jpe", "cur", "svg", "svgz", "ico", "webp", "tif", "tiff"],
37 | file_archive: ["rar", "zip", "7z", "iso"],
38 | windows: ["exe"],
39 | apple: ["ipa"],
40 | android: ["apk"],
41 | file_alt: ["txt", "rtf"],
42 | file_excel: ["xls", "xlsx"], // xlsm 等以及模板?
43 | file_word: ["doc", "docx"],
44 | file_powerpoint: ["ppt", "pptx"],
45 | file_pdf: ["pdf"],
46 | };
47 | var point = filename.lastIndexOf(".");
48 | var t = filename.substr(point + 1);
49 | if (t === "") return "";
50 | t = t.toLowerCase();
51 | for (var icon in filetype) for (var type in filetype[icon]) if (t === filetype[icon][type]) return "fa-" + icon.replace('_', '-');
52 | return "";
53 | }
54 | function OpenRoot(surl, pwd){
55 | var form = $('');
56 | form.append(``);
57 | $(document.body).append(form); form.submit();
58 | }
--------------------------------------------------------------------------------
/functions.php:
--------------------------------------------------------------------------------
1 |
12 | * @link https://imwcr.cn/
13 | * @link https://space.bilibili.com/88197958
14 | *
15 | * @author LC
16 | * @link https://lcwebsite.cn/
17 | * @link https://space.bilibili.com/52618445
18 | */
19 | if (!defined('init')){ // 直接访问处理程序
20 | http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./'); define('init', true);
21 | if (file_exists('config.php')) {
22 | require('config.php');
23 | die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的有关文件!\r\n禁止直接访问!");
24 | } else {
25 | http_response_code(503); header('Refresh: 5;url=https://github.com/lc6464/PanDownload-PHP-Optimized');
26 | die("HTTP 503 服务不可用!\r\n缺少相关配置和定义文件!无法正常运行程序!\r\n请重新 Clone 项目并配置!\r\n将在五秒内跳转到 GitHub 储存库!");
27 | }
28 | }
29 |
30 | // main
31 | function setCurl(&$ch, array $header) { // 批处理 curl
32 | $a = curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 忽略证书
33 | $b = curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 不检查证书与域名是否匹配(2为检查)
34 | $c = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 以字符串返回结果而非输出
35 | $d = curl_setopt($ch, CURLOPT_HTTPHEADER, $header); // 请求头
36 | return($a&&$b&&$c&&$d);
37 | }
38 | function post(string $url, $data, array $header) { // POST 发送数据
39 | $ch = curl_init($url);
40 | setCurl($ch, $header);
41 | curl_setopt($ch, CURLOPT_POST, true); // POST 方法
42 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // POST 的数据
43 | $result = curl_exec($ch);
44 | curl_close($ch);
45 | return $result;
46 | }
47 | function get(string $url, array $header) { // GET 请求数据
48 | $ch = curl_init($url);
49 | setCurl($ch, $header);
50 | $result = curl_exec($ch);
51 | curl_close($ch);
52 | return $result;
53 | }
54 | function head(string $url, array $header) { // 获取响应头
55 | $ch = curl_init($url);
56 | setCurl($ch, $header);
57 | curl_setopt($ch, CURLOPT_HEADER, true); // 返回响应头
58 | curl_setopt($ch, CURLOPT_NOBODY, true); // 只要响应头
59 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
60 | $response = curl_exec($ch);
61 | $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); // 获得响应头大小
62 | $result = substr($response, 0, $header_size); // 根据头大小获取头信息
63 | curl_close($ch);
64 | return $result;
65 | }
66 | function getSubstr(string $str, string $leftStr, string $rightStr) {
67 | $left = strpos($str, $leftStr); // echo '左边:'.$left;
68 | $right = strpos($str, $rightStr, $left); // echo '
右边:'.$right;
69 | if ($left < 0 or $right < $left) return '';
70 | $left += strlen($leftStr);
71 | return substr($str, $left, $right - $left);
72 | }
73 | function formatSize(float $size, int $times = 0) { // 格式化size显示
74 | if ($size > 1024) {
75 | $size /= 1024;
76 | return formatSize($size, $times + 1); // 递归处理
77 | } else {
78 | switch ($times) {
79 | case '0':
80 | $unit = ($size == 1) ? 'Byte' : 'Bytes'; break;
81 | case '1':
82 | $unit = 'KB'; break;
83 | case '2':
84 | $unit = 'MB'; break;
85 | case '3':
86 | $unit = 'GB'; break;
87 | case '4':
88 | $unit = 'TB'; break;
89 | case '5':
90 | $unit = 'PB'; break;
91 | case '6':
92 | $unit = 'EB'; break;
93 | case '7':
94 | $unit = 'ZB'; break;
95 | default:
96 | $unit = '单位未知';
97 | }
98 | return sprintf('%.3f', $size) . $unit;
99 | }
100 | }
101 | function CheckPassword() { // 校验密码
102 | if (IsCheckPassword) {
103 | if (!isset($_POST["Password"])) {
104 | if (isset($_SESSION["Password"])) {
105 | if ($_SESSION["Password"] === Password) {
106 | echo (isset($_POST["dir"]) || isset($_SESSION["ShowAlert"])) ? ''
107 | : '';
108 | $_SESSION['ShowAlert'] = true; return;
109 | }
110 | }
111 | } else {
112 | if ($_POST["Password"] === Password) {
113 | $_SESSION['Password'] = $_POST["Password"];
114 | echo (isset($_POST["dir"]) || isset($_SESSION["ShowAlert"])) ? ''
115 | : '';
116 | $_SESSION['ShowAlert'] = true; return;
117 | }
118 | }
119 | die('