├── 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('
120 |
121 |
'); 122 | } 123 | } 124 | // 解析分享链接 125 | function verifyPwd(string $surl_1, string $pwd) { // 验证提取码 126 | $url = 'https://pan.baidu.com/share/verify?channel=chunlei&clienttype=0&web=1&app_id=250528&surl=' . $surl_1; 127 | $data = "pwd=$pwd"; 128 | $header = array("User-Agent: netdisk", "Referer: https://pan.baidu.com/disk/home"); 129 | $result = json_decode(post($url, $data, $header), true); // -12 提取码错误 130 | if ($result["errno"] === 0) return $result["randsk"]; 131 | else return 1; 132 | } 133 | function getSign(string $surl, $randsk) { 134 | if ($randsk === 1) return 1; 135 | $url = 'https://pan.baidu.com/s/1' . $surl; 136 | $header = array( 137 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36", 138 | "Cookie: BDUSS=" . BDUSS . ";STOKEN=" . STOKEN . ";BDCLND=" . $randsk . ";" 139 | ); 140 | if (preg_match('/yunData.setData\((\{.*?\})\);/', get($url, $header), $matches)) return json_decode($matches[1], true); 141 | else return 1; 142 | } 143 | function FileList($sign) { 144 | if ($sign === 1) return 1; 145 | return $sign['file_list'] === null ? 1 : $sign['file_list']; 146 | } 147 | function GetDir(string $dir, string $randsk, string $shareid, string $uk) { 148 | $url = 'https://pan.baidu.com/share/list?shareid='.$shareid.'&uk='.$uk.'&dir='.$dir; 149 | $header = array( 150 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36", 151 | "Cookie: BDUSS=" . BDUSS . ";STOKEN=" . STOKEN . ";BDCLND=" . $randsk . ";", 152 | "Referer: https://pan.baidu.com/disk/home" 153 | ); 154 | return json_decode(get($url, $header), true); 155 | } 156 | function FileInfo(string $filename, float $size, string $md5, int $server_ctime) { // 输出 HTML 字符串 157 | return '

文件名:' . $filename . '

文件大小:' . formatSize($size) . '

文件MD5:' . $md5 158 | . '

上传时间:' . date("Y年m月d日 H:i:s", $server_ctime) . '

'; 159 | } 160 | function getDlink(string $fs_id, string $timestamp, string $sign, string $randsk, string $share_id, string $uk) { // 获取下载链接 161 | $url = 'https://pan.baidu.com/api/sharedownload?app_id=250528&channel=chunlei&clienttype=12&sign=' . $sign . '×tamp=' . $timestamp . '&web=1'; 162 | $data = "encrypt=0" . "&extra=" . urlencode('{"sekey":"' . urldecode($randsk) . '"}') . "&fid_list=[$fs_id]" . "&primaryid=$share_id" . "&uk=$uk" . "&product=share&type=nolimit"; 163 | $header = array( 164 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36", 165 | "Cookie: BDUSS=" . BDUSS . ";STOKEN=" . STOKEN . ";BDCLND=" . $randsk . ";", 166 | "Referer: https://pan.baidu.com/disk/home" 167 | ); 168 | return json_decode(post($url, $data, $header), true); 169 | //没有 referer 就 112 ,然后没有 sekey 参数就 118 -20??? 170 | // 参数 类型 描述 171 | // list json array 文件信息列表 172 | // names json 如果查询共享目录,该字段为共享目录文件上传者的uk和账户名称 173 | // list[0]["category"] int 文件类型 174 | // list[0]["dlink"] string 文件下载地址 175 | // list[0]["file_name"] string 文件名 176 | // list[0]["isdir"] int 是否是目录 177 | // list[0]["server_ctime"] int 文件的服务器创建时间 178 | // list[0]["server_mtime"] int 文件的服务修改时间 179 | // list[0]["size"] int 文件大小 180 | // list[0]["thumbs"] 缩略图地址 181 | // list[0]["height"] int 图片高度 182 | // list[0]["width"] int 图片宽度 183 | // list[0]["date_taken"] int 图片拍摄时间 184 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 17 | * @link https://imwcr.cn/ 18 | * @link https://space.bilibili.com/88197958 19 | * 20 | * @author LC 21 | * @link https://lcwebsite.cn/ 22 | * @link https://space.bilibili.com/52618445 23 | */ 24 | session_start(); 25 | define('init', true); 26 | if (version_compare(PHP_VERSION, '7.0.0', '<')) { 27 | http_response_code(503); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 5;url=https://www.php.net/downloads.php'); 28 | die("HTTP 503 服务不可用!\r\nPHP 版本过低!无法正常运行程序!\r\n请安装 7.0.0 或以上版本的 PHP!\r\n将在五秒内跳转到 PHP 官方下载页面!"); 29 | } 30 | if (!(file_exists('config.php') && file_exists('functions.php'))) { 31 | http_response_code(503); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 5;url=https://github.com/lc6464/PanDownload-PHP-Optimized'); 32 | die("HTTP 503 服务不可用!\r\n缺少相关配置和定义文件!无法正常运行程序!\r\n请重新 Clone 项目并配置!\r\n将在五秒内跳转到 GitHub 储存库!"); 33 | } 34 | // 导入配置和函数 35 | require('config.php'); require('functions.php'); 36 | // 通用响应头 37 | header('Content-Type: text/html; charset=utf-8'); 38 | header('X-UA-Compatible: IE=edge,chrome=1'); 39 | ?> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | PanDownload 复刻版 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 78 |
79 | 80 |
81 |
82 | 118 |
119 |
120 |
'; // 鬼知道发生了啥 136 | else { // 终于正常了 137 | $link = str_replace(strrchr(str_replace(strrchr($_POST["dir"],'/'), '', $_POST["dir"]),'/'), '', str_replace(strrchr($_POST["dir"],'/'), '', $_POST["dir"])) === '' 138 | ? '/(根目录)' 139 | : '..(上级目录)'; 140 | $filecontent = '
    ' 141 | . '
  • ' . $link . '
  • '; 142 | for ($i = 0; $i < count($filejson["list"]); $i++) { 143 | $file = $filejson["list"][$i]; 144 | if ($file["isdir"] === 0) $filecontent .= '
  • 145 | '.$file["server_filename"].' 146 | ' . formatSize($file["size"]) . '
  • '; 147 | else $filecontent .= '
  • 148 | ' . $file["server_filename"] . '
  • '; 149 | } 150 | echo $filecontent . "
"; 151 | } 152 | } else echo '
'; 154 | } else { 155 | $surl_1 = substr($surl, 1); 156 | if ($pwd !== '') $randsk = verifyPwd($surl_1, $pwd); 157 | else $randsk = ''; 158 | $root = getSign($surl_1, $randsk); 159 | $filejson = FileList($root); 160 | if ($filejson !== 1) { 161 | $sign = $root["sign"]; 162 | $timestamp = $root["timestamp"]; 163 | $shareid = $root["shareid"]; 164 | $uk = $root["uk"]; 165 | if ($filejson["errno"] != 0) echo '
'; // 鬼知道发生了啥 167 | else { // 终于正常了 168 | $filecontent = '
    '; 169 | for ($i = 0; $i < count($filejson["list"]); $i++) { 170 | $file = $filejson["list"][$i]; 171 | if ($file["isdir"] === 0) $filecontent .= '
  • 172 | '.$file["server_filename"].' 173 | ' . formatSize($file["size"]) . '
  • '; 174 | else $filecontent .= '
  • 175 | ' . $file["server_filename"] . '
  • '; 176 | } 177 | echo $filecontent . "
"; 178 | } 179 | } else echo '
'; 181 | } 182 | } elseif (isset($_GET["download"])) { // 解析下载地址页面 183 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { 184 | if (isset($_POST["fs_id"]) && isset($_POST["time"]) && isset($_POST["sign"]) && isset($_POST["randsk"]) && isset($_POST["share_id"]) && isset($_POST["uk"])) { 185 | $fs_id = $_POST["fs_id"]; 186 | $timestamp = $_POST["time"]; 187 | $sign = $_POST["sign"]; 188 | $randsk = $_POST["randsk"]; 189 | $share_id = $_POST["share_id"]; 190 | $uk = $_POST["uk"]; 191 | $json4 = getDlink($fs_id, $timestamp, $sign, $randsk, $share_id, $uk); 192 | if ($json4["errno"] == 0) { 193 | $dlink = $json4["list"][0]["dlink"]; 194 | $md5 = $json4["list"][0]["md5"]; 195 | $filename = $json4["list"][0]["server_filename"]; 196 | $size = $json4["list"][0]["size"]; 197 | $server_ctime = (int)$json4["list"][0]["server_ctime"] + 28800; // 服务器创建时间 +8:00 198 | $headerArray = array( 'User-Agent: LogStatistic', 'Cookie: BDUSS=' . BDUSS . ';' ); 199 | $getRealLink = head($dlink, $headerArray); // 禁止重定向 200 | $getRealLink = strstr($getRealLink, "Location"); 201 | $getRealLink = substr($getRealLink, 10); 202 | $realLink = getSubstr($getRealLink, "http://", "\r\n"); // 删除 http:// 203 | // 1. 使用 dlink 下载文件 2. dlink 有效期为8小时 3. 必需要设置 User-Agent 字段 4. dlink 存在 HTTP 302 跳转 204 | if ($realLink == "") echo '
'; // 未配置 SVIP 账号 207 | else echo '
'; // 成功! 210 | } else echo '
'; // 未知错误 212 | } else echo '
'; // 参数不齐 214 | } else echo '
'; // 方法错误 216 | } else { // 首页 ?> 217 |
218 |
219 |
百度网盘分享链接在线解析
220 |
221 |
222 |
223 |
224 |
'; 227 | if (isset($_SESSION["Password"])) { 228 | if ($_SESSION["Password"] === Password) { 229 | $return = '
您的设备在短期内已经验证过,无需再次输入密码。
'; 230 | } 231 | } 232 | echo $return; 233 | } // 密码 234 | ?> 235 | 236 | 237 |
238 |
239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | --------------------------------------------------------------------------------