├── LICENSE ├── README.md ├── WebAN.zip ├── dht.dat ├── doc ├── README.md └── 离线下载.md ├── dplayer.php ├── ffmpeg.php ├── gbk.zip ├── index.php ├── jugg.php ├── more.php ├── moreinfo.php ├── wadir-ajax.php ├── wadir-dplay.php └── wadir.php /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "{}" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright 2016 Egist 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webdir 2 | ## index.php 3 | index.php放在你的网站根目录并且设置好你的所在目录权限即可[用于目录浏览] 4 | 5 | 1.图标图片预览支持IE浏览器 6 | 7 | 2.手机端自动缩放 8 | 9 | 开启密码请将前面的"//"删去,默认密码为123 10 | ``` 11 | //define("PASS","123");// 12 | ``` 13 | 只展示该目录以下的所有文件,通过添加禁止显示文件夹以及后缀文件来控制显示 14 | 15 | 例如: 16 | ``` 17 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 18 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 19 | ``` 20 | 21 | 支持在线播放mp4视频和MP3音频以及PDF在线预览,对于手机的自适应不是特别完美。 22 | 23 | eg:http://webdir.cc/ 24 | 25 | LNMP LAMP 一键包测试通过, **windows下惨不忍睹** 26 | 27 | ## WabAN 28 | 29 | Webdir下外挂一个[AriaNg](https://github.com/mayswind/AriaNg)来控制下载(注意:Aria2请务必安装不然会显示“未连接”)。 30 | 31 | 32 | ![界面](http://bilibara.com/images/2017/06/19/wan1.png) 33 | 34 | ![AriaNg下载界面](http://bilibara.com/images/2017/06/19/wan.png) 35 | 36 | ### 安装WebAN 37 | 安装[Aria2](https://github.com/maysrp/webdir/blob/master/doc/%E7%A6%BB%E7%BA%BF%E4%B8%8B%E8%BD%BD.md#aria2-安装) 38 | 39 | 下载[WebAN.zip](https://github.com/maysrp/webdir/raw/master/WebAN.zip)并解压到你的想放的web目录,在index.php文件顶部可以编辑密码,默认密码为admin,访问你的对应的网站即可。 40 | 41 | ## wadir-ajax.php 42 | 43 | 与下面的wadir.php安装步骤以及功能完全相同,但是aria2下载操作全部换成AJAX进行,界面稍微好于wadir.php.定时刷新30S一次,可以手动刷新。 44 | 45 | ![Aria2控制界面](http://bilibara.com/images/2017/02/23/ari.png) 46 | 47 | ## wadir.php 48 | 49 | 详细安装方法:https://github.com/maysrp/webdir/tree/master/doc 50 | 51 | **对于index.php的扩充** 52 | 53 | 基于php-aria2,需要安装aria2的支持。 54 | 简单的管理: 55 | bt1.png 56 | ec7938932a3f4f0e.png 57 | 关于导入Magnet成功却从未有速度,且不显示文件名的,可能存在的问题,缺少dht.dat,参考下文中的dht.dat的处理方法 58 | ###配置 59 | 密码: 60 | ``` 61 | define("PASS", "admin"); 62 | ``` 63 | 配置显示文件以及文件夹 64 | ``` 65 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 66 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 67 | ``` 68 | ##more.php 69 | ###简单的多用户实现 70 | 创建不同的目录每个目录都放入more.php,配置如下(目录必须可写 0777): 71 | ``` 72 | define("PASS", "admin"); 73 | define("TYPE","d");//定义结算方式,d为每日,m为每月 74 | define("NUM", 1);//每个结束方式内可以下载的数量 75 | ``` 76 | 77 | 每个账户一个目录,登入后能添加magnet,对其进行基本管理。 78 | 79 | ## moreinfo.php 80 | 81 | 121212112212.png 82 | 83 | 多用户控制,可以控制每个用户离线空间的总大小,周期结算类型,每个周期内可用的任务个数,每次任务的大小等...... 84 | 85 | 创建不同的目录每个目录都放入moreinfo.php,配置如下(目录必须可写 0777): 86 | ``` 87 | define("PASS", "admin"); 88 | define("TYPE","d");//定义结算方式,d为每日,m为每月 89 | define("NUM", 1);//每个结束方式内可以下载的数量 90 | define("DISK", 20);//单位GB,定义总空间大小 91 | define("MAX", 10);//单位GB,定义每个任务的大小[超出自动删除任务] 92 | ``` 93 | 每个账户一个目录,登入后能添加magnet,对其进行基本管理。 94 | ##dplayer.php 95 | 使用dplayer播放器的index.php; 96 | ##wadir-dplay.php 97 | 使用dplayer播放器的wadir.php; 98 | ##wardir/ 99 | 100 | 移动到:https://github.com/maysrp/wardir 101 | 102 | ## jugg.php 103 | 该文件只用于检测你是否完成了aria2的配置,上传到你的网站根目录访问即可,如有正常的文件下载信息表示完成了aria2配置,删除该文件即可。 104 | ##dht.dat 105 | 有些新安装aria2,可能会因为缺少dht.dat导致无法magnet下载,拷贝该文件到你的/root/.aria2/下即可 106 | 107 | ## ffmpge.php 108 | 109 | 基本界面和之前类似: 110 | ![ffmpeg](http://git.oschina.net/uploads/images/2016/1219/040352_a973d056_700748.png "界面") 111 | 黄色的就是转换符号,未用到任何数据库,没有转换完成通知,调用时间根据你的设置的PHP脚本运行时间为止。 112 | 在线转码,请 113 | php.ini中修改: 114 | 115 | 删去禁用的exec 116 | 117 | 以及修改脚本运行时间1000s: 118 | 119 | max_execution_time = 1000; 120 | 121 | 修改配置后记得重新启动php端: 122 | 123 | 服务端安装ffmpeg 124 | ubuntu/debian 安装ffmpeg 125 | ``` 126 | sudo apt-get install ffmpeg 127 | ``` 128 | VPS转码效率底下 129 | [vultr](http://git.oschina.net/uploads/images/2016/1219/035456_77bbf7bf_700748.png "转换速度") 130 | 默认是webm格式的视频修改 131 | 132 | ``` 133 | return "|"; 134 | ``` 135 | 136 | 改变为: 137 | 138 | 139 | ``` 140 | return "|"; 141 | ``` 142 | 143 | ## gbk.zip 144 | 如果中文乱码请解压使用该脚本 145 | 146 | 147 | -------------------------------------------------------------------------------- /WebAN.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maysrp/webdir/bc7da2fb350bce26463ec0555482657b1413bd0d/WebAN.zip -------------------------------------------------------------------------------- /dht.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maysrp/webdir/bc7da2fb350bce26463ec0555482657b1413bd0d/dht.dat -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | ## wadir.php 2 | 3 | ### USAGE 4 | 5 | #### Aria2 6 | 7 | Debian 8 | 9 | 10 | install Aria2 11 | 12 | 13 | ``` 14 | apt-get install -y aria2 15 | ``` 16 | 17 | install screen 18 | 19 | ``` 20 | apt-get install -y screen 21 | ``` 22 | 23 | Aria2 config 24 | 25 | ``` 26 | mkdir /root/.aria2 27 | 28 | cd /root/.aria2 29 | 30 | wget http://webdir.cc/aria2.conf /root/.aria2/aria2.conf 31 | 32 | 33 | wget http://webdir.cc/dht.dat /root/.aria2/dht.dat 34 | 35 | 36 | echo '' > /root/aria2.session 37 | 38 | ``` 39 | 40 | start up Aria2 41 | 42 | ``` 43 | screen -dmS aria2 aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all -c 44 | ``` 45 | 46 | #### wadir.php 47 | 48 | upload *wadir.php* on your WWW directory 49 | 50 | set password 51 | ``` 52 | define("PASS","Password"); 53 | ``` 54 | set forbidden access directory [notdir] and extension [notex] 55 | ``` 56 | $this->notdir=array("a","phpmyadmin"); 57 | $this->notex=array("php","js","tgz"); 58 | ``` 59 | 60 | visit http://yourdomain/wadir.php by your browser 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/离线下载.md: -------------------------------------------------------------------------------- 1 | ## 离线下载 wadir.php 2 | ### Aria2 安装: 3 | 4 | Debian 8系统 apt-get 安装Aria2 5 | 6 | ``` 7 | apt-get update && apt-get install -y aria2 8 | ``` 9 | 10 | 创建目录: 11 | 12 | ``` 13 | mkdir /root/.aria2 14 | 15 | cd /root/.aria2 16 | ``` 17 | 18 | 修改配置文件: 下载配置文件:http://webdir.cc/aria2.conf 19 | 20 | 修改配置信息请参考:aria2.conf 21 | 22 | 保存到刚刚的目录上 23 | 24 | ``` 25 | wget http://webdir.cc/aria2.conf /root/.aria2/aria2.conf 26 | ``` 27 | 28 | 下载http://webdir.cc/dht.dat dht.dat 到/root/.aria2/ 29 | ``` 30 | wget http://webdir.cc/dht.dat /root/.aria2/dht.dat 31 | ``` 32 | 执行命令: 33 | ``` 34 | echo '' > /root/aria2.session 35 | ``` 36 | 执行命令,让aria2启动: 37 | 若没安装screen 请先 38 | ``` 39 | apt-get install -y screen 40 | ``` 41 | 42 | 在安装好screen后执行 43 | ``` 44 | screen -dmS aria2 aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all -c 45 | ``` 46 | ### wadir.php安装 47 | 将wadir.php上传到你的网站根目录 48 | 49 | 设置密码 50 | ``` 51 | define("PASS","123");// 52 | ``` 53 | 只展示该目录以下的所有文件,通过添加禁止显示文件夹以及后缀文件来控制显示 54 | 55 | 例如: 56 | ``` 57 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 58 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 59 | ``` 60 | 访问 61 | http://你的域名/wadir.php 即可 62 | -------------------------------------------------------------------------------- /dplayer.php: -------------------------------------------------------------------------------- 1 | notex=array("php","js","tgz");//不允许显示的后缀名文件 14 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 15 | if (isset($_GET['dir'])) { 16 | foreach ($this->notdir as $key => $value) { 17 | if(strtolower($_GET['dir'])==$value){ 18 | $_GET['dir']="."; 19 | } 20 | } 21 | $tom=trim($_GET['dir']); 22 | $tam=str_replace("..", ".", $tom); 23 | $this->dir="./".$tam; 24 | }else{ 25 | $this->dir="."; 26 | } 27 | } 28 | function ex($string){ 29 | $ar=explode(".", $string); 30 | $ex=array_pop($ar); 31 | return strtolower($ex); 32 | } 33 | function open_dir(){ 34 | if(is_dir($this->dir)){ 35 | if($dh=opendir($this->dir)){ 36 | while(($file=readdir($dh))!==false){ 37 | $this->jugg($file); 38 | } 39 | //sort($this->file); 40 | //sort($this->dirdir); 41 | closedir($dh); 42 | } 43 | }else{ 44 | echo "error"; 45 | } 46 | } 47 | function jugg($jugg){ 48 | if($jugg!="."&&$jugg!=".."){ 49 | if (is_dir($this->dir."/".$jugg)) { 50 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 51 | $this->dirdir[]=$this->dir."/".$jugg; 52 | } 53 | }else{ 54 | $ex=$this->ex($jugg); 55 | if(!in_array($ex, $this->notex)){ 56 | $this->file[]=$this->dir."/".$jugg; 57 | } 58 | } 59 | } 60 | } 61 | function dirurl($dir){ 62 | $urf=substr($dir,2 ); 63 | return "?dir=".rawurlencode($urf); 64 | } 65 | function value($value){ 66 | $urf=substr($value,2 ); 67 | return $urf; 68 | } 69 | function type($file){ 70 | $ex=$this->ex($file); 71 | switch ($ex) { 72 | case 'png': 73 | case 'jpg': 74 | case 'gif': 75 | case 'bmp': 76 | case 'jpeg': 77 | return "img"; 78 | break; 79 | case 'torrent': 80 | return "torrent"; 81 | break; 82 | case 'mp3': 83 | return "mp3"; 84 | break; 85 | case 'mp4': 86 | case 'ogg': 87 | case 'webm': 88 | return "video"; 89 | break; 90 | case 'xls': 91 | case 'xlsx': 92 | case 'doc': 93 | case 'docx': 94 | case 'ppt': 95 | case 'pptx': 96 | return "other"; 97 | break; 98 | case 'pdf': 99 | return "pdf"; 100 | break; 101 | case 'txt': 102 | case 'json': 103 | case 'xml': 104 | case 'html': 105 | case 'md': 106 | return "text"; 107 | break; 108 | default: 109 | return "other"; 110 | break; 111 | } 112 | } 113 | function download($file){ 114 | return ""; 115 | } 116 | function md5($file){ 117 | return md5_file($file); 118 | } 119 | function other($file){ 120 | 121 | 122 | } 123 | function img($img){ 124 | 125 | } 126 | function pdf($pdf){ 127 | 128 | } 129 | function video($video){ 130 | 131 | } 132 | function mp3($mp3){ 133 | 134 | } 135 | function torrent($torrent){ 136 | 137 | } 138 | function filename($file){ 139 | $ar=explode("/", $file); 140 | return array_pop($ar); 141 | } 142 | function text($file){ 143 | 144 | } 145 | function size($file){ 146 | $fz=filesize($file); 147 | if ($fz>(1024*1024*1024)) { 148 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 149 | }elseif ($fz>(1024*1024)) { 150 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 151 | }elseif($fz>1024){ 152 | return sprintf("%.2f",$fz/1024)."KB"; 153 | }else{ 154 | return $fz."B"; 155 | } 156 | } 157 | function mtime($file){ 158 | return date("Y-m-d H:i:s",filemtime($file)); 159 | } 160 | function atime($file){ 161 | return date("Y-m-d H:i:s",fileatime($file)); 162 | } 163 | function ctime($file){ 164 | return date("Y-m-d H:i:s",filectime($file)); 165 | 166 | } 167 | function icon($file){ 168 | $ex=$this->ex($file); 169 | switch ($ex) { 170 | case 'png': 171 | case 'jpg': 172 | case 'gif': 173 | case 'bmp': 174 | case 'jpeg': 175 | return "glyphicon glyphicon-picture"; 176 | break; 177 | case 'torrent': 178 | return "glyphicon glyphicon-magnet"; 179 | break; 180 | case 'mp3': 181 | return "glyphicon glyphicon-music"; 182 | break; 183 | case 'mp4': 184 | case 'ogg': 185 | case 'webm': 186 | return "glyphicon glyphicon-film"; 187 | break; 188 | case 'xls': 189 | case 'xlsx': 190 | case 'doc': 191 | case 'docx': 192 | case 'ppt': 193 | case 'pptx': 194 | return "glyphicon glyphicon-pencil"; 195 | break; 196 | case 'pdf': 197 | return "glyphicon glyphicon-book"; 198 | break; 199 | case 'txt': 200 | case 'md': 201 | return "glyphicon glyphicon-file"; 202 | break; 203 | default: 204 | return "glyphicon glyphicon-stop"; 205 | break; 206 | } 207 | } 208 | function pre(){ 209 | $dir_array=explode("/", $this->dir); 210 | $num=count($dir_array); 211 | if($num>=2){ 212 | @array_shift($dir_array); 213 | $url="/."; 214 | $step=""; 215 | foreach ($dir_array as $key => $value) { 216 | $step=$step.$value."/"; 217 | $url=$url."/".$value.""; 218 | } 219 | return $url; 220 | } 221 | 222 | } 223 | } 224 | ?> 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | Webdir-danmu 238 | 251 | 252 | 253 | 265 |
266 |
267 |
268 |

Webdir

269 |
270 |
271 |
272 |
273 | 274 | 275 | 276 | 277 |
278 |
279 |
280 |
281 |
282 | Powered by Webdir 283 |
284 |
285 | 286 | open_dir(); 297 | 298 | ?> 299 |
300 |
301 |
302 | " 304 | >

305 |
306 |
307 |

308 | pre(); 310 | ?>

311 |
312 |
313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | dirdir)){ 322 | foreach ($x->dirdir as $key => $value) { 323 | echo ""; 324 | echo ""; 325 | echo ""; 326 | echo ""; 327 | echo ""; 328 | echo ""; 329 | } 330 | } 331 | if(isset($x->file)){ 332 | foreach ($x->file as $key => $value) { 333 | echo ""; 334 | echo ""; 335 | echo ""; 336 | echo ""; 337 | echo ""; 338 | echo ""; 339 | } 340 | } 341 | 342 | 343 | 344 | ?> 345 | 346 | 347 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\" md5=\"".$x->md5($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
348 | Powered by webdir 349 |
350 | 351 |
352 | 366 |
367 | 368 | 441 | 444 | 445 | 446 | -------------------------------------------------------------------------------- /ffmpeg.php: -------------------------------------------------------------------------------- 1 | notex=array("php","js","tgz");//不允许显示的后缀名文件 16 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 17 | if($_GET['video']){ 18 | $type=isset($_GET['type'])?$_GET['type']:"webm"; 19 | $this->ffmpeg($_GET['video'],$type); 20 | 21 | } 22 | if ($_GET['dir']) { 23 | foreach ($this->notdir as $key => $value) { 24 | if(strtolower($_GET['dir'])==$value){ 25 | $_GET['dir']="."; 26 | } 27 | } 28 | $tom=trim($_GET['dir']); 29 | $tam=str_replace("..", ".", $tom); 30 | $this->dir="./".$tam; 31 | }else{ 32 | $this->dir="."; 33 | } 34 | } 35 | function open_dir(){ 36 | if(is_dir($this->dir)){ 37 | if($dh=opendir($this->dir)){ 38 | while(($file=readdir($dh))!==false){ 39 | $this->jugg($file); 40 | } 41 | sort($this->file); 42 | sort($this->dirdir); 43 | closedir($dh); 44 | } 45 | }else{ 46 | echo "error"; 47 | } 48 | } 49 | function jugg($jugg){ 50 | if($jugg!="."&&$jugg!=".."){ 51 | if (is_dir($this->dir."/".$jugg)) { 52 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 53 | $this->dirdir[]=$this->dir."/".$jugg; 54 | } 55 | }else{ 56 | $ex=array_pop(explode(".", $jugg)); 57 | if(!in_array(strtolower($ex), $this->notex)){ 58 | $this->file[]=$this->dir."/".$jugg; 59 | } 60 | } 61 | } 62 | } 63 | function dirurl($dir){ 64 | $urf=substr($dir,2 ); 65 | return "?dir=".$urf; 66 | } 67 | function type($file){ 68 | $ex=strtolower(array_pop(explode(".", $file))); 69 | switch ($ex) { 70 | case 'png': 71 | case 'jpg': 72 | case 'gif': 73 | case 'bmp': 74 | case 'jpeg': 75 | return "img"; 76 | break; 77 | case 'torrent': 78 | return "torrent"; 79 | break; 80 | case 'mp3': 81 | return "mp3"; 82 | break; 83 | case 'mp4': 84 | case 'ogg': 85 | case 'webm': 86 | return "video"; 87 | break; 88 | case 'xls': 89 | case 'xlsx': 90 | case 'doc': 91 | case 'docx': 92 | case 'ppt': 93 | case 'pptx': 94 | return "other"; 95 | break; 96 | case 'pdf': 97 | return "pdf"; 98 | break; 99 | case 'txt': 100 | case 'json': 101 | case 'xml': 102 | case 'html': 103 | case 'md': 104 | return "text"; 105 | break; 106 | default: 107 | return "other"; 108 | break; 109 | } 110 | } 111 | function download($file){ 112 | $info=pathinfo($file); 113 | 114 | $my_ex=strtolower($info['extension']); 115 | 116 | $ex=array("mkv","flv","avi","rm","rmvb","3gp"); 117 | if(in_array($my_ex, $ex)){ 118 | return "|"; 119 | }else{ 120 | return ""; 121 | } 122 | } 123 | function other($file){ 124 | 125 | 126 | } 127 | function img($img){ 128 | 129 | } 130 | function pdf($pdf){ 131 | 132 | } 133 | function video($video){ 134 | 135 | } 136 | function mp3($mp3){ 137 | 138 | } 139 | function torrent($torrent){ 140 | 141 | } 142 | function filename($file){ 143 | return array_pop(explode("/", $file)); 144 | } 145 | function text($file){ 146 | 147 | } 148 | function size($file){ 149 | $fz=filesize($file); 150 | if ($fz>(1024*1024*1024)) { 151 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 152 | }elseif ($fz>(1024*1024)) { 153 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 154 | }elseif($fz>1024){ 155 | return sprintf("%.2f",$fz/1024)."KB"; 156 | }else{ 157 | return $fz."B"; 158 | } 159 | } 160 | function mtime($file){ 161 | return date("Y-m-d H:i:s",filemtime($file)); 162 | } 163 | function atime($file){ 164 | return date("Y-m-d H:i:s",fileatime($file)); 165 | } 166 | function ctime($file){ 167 | return date("Y-m-d H:i:s",filectime($file)); 168 | 169 | } 170 | function ffmpeg($value,$type="webm"){//视频文件 171 | $video=$value.".".$type; 172 | $ecex="ffmpeg -i ".$value." " .$video; 173 | exec($ecex); 174 | 175 | } 176 | function icon($file){ 177 | $ex=strtolower(array_pop(explode(".", $file))); 178 | switch ($ex) { 179 | case 'png': 180 | case 'jpg': 181 | case 'gif': 182 | case 'bmp': 183 | case 'jpeg': 184 | return "glyphicon glyphicon-picture"; 185 | break; 186 | case 'torrent': 187 | return "glyphicon glyphicon-magnet"; 188 | break; 189 | case 'mp3': 190 | return "glyphicon glyphicon-music"; 191 | break; 192 | case 'mp4': 193 | case 'ogg': 194 | case 'webm': 195 | return "glyphicon glyphicon-film"; 196 | break; 197 | case 'xls': 198 | case 'xlsx': 199 | case 'doc': 200 | case 'docx': 201 | case 'ppt': 202 | case 'pptx': 203 | return "glyphicon glyphicon-pencil"; 204 | break; 205 | case 'pdf': 206 | return "glyphicon glyphicon-book"; 207 | break; 208 | case 'txt': 209 | case 'md': 210 | return "glyphicon glyphicon-file"; 211 | break; 212 | default: 213 | return "glyphicon glyphicon-stop"; 214 | break; 215 | } 216 | } 217 | function pre(){ 218 | $dir_array=explode("/", $this->dir); 219 | $num=count($dir_array); 220 | if($num>=2){ 221 | @array_shift($dir_array); 222 | $url="/."; 223 | foreach ($dir_array as $key => $value) { 224 | $step=$step.$value."/"; 225 | $url=$url."/".$value.""; 226 | } 227 | return $url; 228 | } 229 | 230 | } 231 | } 232 | 233 | $x=new dir(); 234 | $x->open_dir(); 235 | 236 | ?> 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | Vardir 249 | 262 | 263 | 264 |
265 |
266 |
267 |

271 |
272 |
273 |

274 | pre(); 276 | ?>

277 |
278 |
279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | dirdir as $key => $value) { 288 | echo ""; 289 | echo ""; 290 | echo ""; 291 | echo ""; 292 | echo ""; 293 | echo ""; 294 | } 295 | foreach ($x->file as $key => $value) { 296 | echo ""; 297 | echo ""; 298 | echo ""; 299 | echo ""; 300 | echo ""; 301 | echo ""; 302 | } 303 | 304 | 305 | 306 | ?> 307 | 308 | 309 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".rawurlencode($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
310 | Powered by webdir 311 |
312 | 313 |
314 | 328 |
329 | 389 | 390 | -------------------------------------------------------------------------------- /gbk.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maysrp/webdir/bc7da2fb350bce26463ec0555482657b1413bd0d/gbk.zip -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | notex=array("php","js","tgz");//不允许显示的后缀名文件 14 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 15 | if ($_GET['dir']) { 16 | foreach ($this->notdir as $key => $value) { 17 | if(strtolower($_GET['dir'])==$value){ 18 | $_GET['dir']="."; 19 | } 20 | } 21 | $tom=trim($_GET['dir']); 22 | $tam=str_replace("..", ".", $tom); 23 | $this->dir="./".$tam; 24 | }else{ 25 | $this->dir="."; 26 | } 27 | } 28 | function ex($string){ 29 | $ar=explode(".", $string); 30 | $ex=array_pop($ar); 31 | return strtolower($ex); 32 | } 33 | function open_dir(){ 34 | if(is_dir($this->dir)){ 35 | if($dh=opendir($this->dir)){ 36 | while(($file=readdir($dh))!==false){ 37 | $this->jugg($file); 38 | } 39 | sort($this->file); 40 | sort($this->dirdir); 41 | closedir($dh); 42 | } 43 | }else{ 44 | echo "error"; 45 | } 46 | } 47 | function jugg($jugg){ 48 | if($jugg!="."&&$jugg!=".."){ 49 | if (is_dir($this->dir."/".$jugg)) { 50 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 51 | $this->dirdir[]=$this->dir."/".$jugg; 52 | } 53 | }else{ 54 | $ex=$this->ex($jugg); 55 | if(!in_array($ex, $this->notex)){ 56 | $this->file[]=$this->dir."/".$jugg; 57 | } 58 | } 59 | } 60 | } 61 | function dirurl($dir){ 62 | $urf=substr($dir,2 ); 63 | return "?dir=".rawurlencode($urf); 64 | } 65 | function value($value){ 66 | $urf=substr($value,2 ); 67 | return $urf; 68 | } 69 | function type($file){ 70 | $ex=$this->ex($file); 71 | switch ($ex) { 72 | case 'png': 73 | case 'jpg': 74 | case 'gif': 75 | case 'bmp': 76 | case 'jpeg': 77 | return "img"; 78 | break; 79 | case 'torrent': 80 | return "torrent"; 81 | break; 82 | case 'mp3': 83 | return "mp3"; 84 | break; 85 | case 'mp4': 86 | case 'ogg': 87 | case 'webm': 88 | return "video"; 89 | break; 90 | case 'xls': 91 | case 'xlsx': 92 | case 'doc': 93 | case 'docx': 94 | case 'ppt': 95 | case 'pptx': 96 | return "other"; 97 | break; 98 | case 'pdf': 99 | return "pdf"; 100 | break; 101 | case 'txt': 102 | case 'json': 103 | case 'xml': 104 | case 'html': 105 | case 'md': 106 | return "text"; 107 | break; 108 | default: 109 | return "other"; 110 | break; 111 | } 112 | } 113 | function download($file){ 114 | return ""; 115 | } 116 | function other($file){ 117 | 118 | 119 | } 120 | function img($img){ 121 | 122 | } 123 | function pdf($pdf){ 124 | 125 | } 126 | function video($video){ 127 | 128 | } 129 | function mp3($mp3){ 130 | 131 | } 132 | function torrent($torrent){ 133 | 134 | } 135 | function filename($file){ 136 | $ar=explode("/", $file); 137 | return array_pop($ar); 138 | } 139 | function text($file){ 140 | 141 | } 142 | function size($file){ 143 | $fz=filesize($file); 144 | if ($fz>(1024*1024*1024)) { 145 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 146 | }elseif ($fz>(1024*1024)) { 147 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 148 | }elseif($fz>1024){ 149 | return sprintf("%.2f",$fz/1024)."KB"; 150 | }else{ 151 | return $fz."B"; 152 | } 153 | } 154 | function mtime($file){ 155 | return date("Y-m-d H:i:s",filemtime($file)); 156 | } 157 | function atime($file){ 158 | return date("Y-m-d H:i:s",fileatime($file)); 159 | } 160 | function ctime($file){ 161 | return date("Y-m-d H:i:s",filectime($file)); 162 | 163 | } 164 | function icon($file){ 165 | $ex=$this->ex($file); 166 | switch ($ex) { 167 | case 'png': 168 | case 'jpg': 169 | case 'gif': 170 | case 'bmp': 171 | case 'jpeg': 172 | return "glyphicon glyphicon-picture"; 173 | break; 174 | case 'torrent': 175 | return "glyphicon glyphicon-magnet"; 176 | break; 177 | case 'mp3': 178 | return "glyphicon glyphicon-music"; 179 | break; 180 | case 'mp4': 181 | case 'ogg': 182 | case 'webm': 183 | return "glyphicon glyphicon-film"; 184 | break; 185 | case 'xls': 186 | case 'xlsx': 187 | case 'doc': 188 | case 'docx': 189 | case 'ppt': 190 | case 'pptx': 191 | return "glyphicon glyphicon-pencil"; 192 | break; 193 | case 'pdf': 194 | return "glyphicon glyphicon-book"; 195 | break; 196 | case 'txt': 197 | case 'md': 198 | return "glyphicon glyphicon-file"; 199 | break; 200 | default: 201 | return "glyphicon glyphicon-stop"; 202 | break; 203 | } 204 | } 205 | function pre(){ 206 | $dir_array=explode("/", $this->dir); 207 | $num=count($dir_array); 208 | if($num>=2){ 209 | @array_shift($dir_array); 210 | $url="/."; 211 | foreach ($dir_array as $key => $value) { 212 | $step=$step.$value."/"; 213 | $url=$url."/".$value.""; 214 | } 215 | return $url; 216 | } 217 | 218 | } 219 | } 220 | ?> 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | Webdir 233 | 246 | 247 | 248 | 257 |
258 |
259 |
260 |

Webdir

261 |
262 |
263 |
264 |
265 | 266 | 267 | 268 | 269 |
270 |
271 |
272 |
273 |
274 | Powered by Webdir 275 |
276 |
277 | 278 | open_dir(); 289 | 290 | ?> 291 |
292 |
293 |
294 |

298 |
299 |
300 |

301 | pre(); 303 | ?>

304 |
305 |
306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | dirdir as $key => $value) { 315 | echo ""; 316 | echo ""; 317 | echo ""; 318 | echo ""; 319 | echo ""; 320 | echo ""; 321 | } 322 | foreach ($x->file as $key => $value) { 323 | echo ""; 324 | echo ""; 325 | echo ""; 326 | echo ""; 327 | echo ""; 328 | echo ""; 329 | } 330 | 331 | 332 | 333 | ?> 334 | 335 | 336 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
337 | Powered by webdir 338 |
339 | 340 |
341 | 355 |
356 | 412 | 413 | 414 | -------------------------------------------------------------------------------- /jugg.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 6 | curl_setopt_array($this->ch, [ 7 | CURLOPT_POST=>true, 8 | CURLOPT_RETURNTRANSFER=>true, 9 | CURLOPT_HEADER=>false 10 | ]); 11 | } 12 | function __destruct(){ 13 | curl_close($this->ch); 14 | } 15 | protected function req($data){ 16 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 17 | return curl_exec($this->ch); 18 | } 19 | function __call($name, $arg){ 20 | $data = [ 21 | 'jsonrpc'=>'2.0', 22 | 'id'=>'1', 23 | 'method'=>'aria2.'.$name, 24 | 'params'=>$arg 25 | ]; 26 | $data = json_encode($data); 27 | $response = $this->req($data); 28 | if($response===false) { 29 | trigger_error(curl_error($this->ch)); 30 | } 31 | return json_decode($response, 1); 32 | } 33 | } 34 | 35 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 36 | $dir=dirname(__FILE__); 37 | var_dump($aria2->addUri(array('https://www.google.com.hk/images/srpr/logo3w.png'),array( 38 | 'dir'=>$dir, 39 | ))); 40 | var_dump($aria2->getGlobalStat()); 41 | -------------------------------------------------------------------------------- /more.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 12 | curl_setopt_array($this->ch, [ 13 | CURLOPT_POST=>true, 14 | CURLOPT_RETURNTRANSFER=>true, 15 | CURLOPT_HEADER=>false 16 | ]); 17 | } 18 | function __destruct(){ 19 | curl_close($this->ch); 20 | } 21 | protected function req($data){ 22 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 23 | return curl_exec($this->ch); 24 | } 25 | function __call($name, $arg){ 26 | $data = [ 27 | 'jsonrpc'=>'2.0', 28 | 'id'=>'1', 29 | 'method'=>'aria2.'.$name, 30 | 'params'=>$arg 31 | ]; 32 | $data = json_encode($data); 33 | $response = $this->req($data); 34 | if($response===false) { 35 | trigger_error(curl_error($this->ch)); 36 | } 37 | return json_decode($response, 1); 38 | } 39 | } 40 | class dir{ 41 | public $dir; 42 | public $file; 43 | public $dirdir; 44 | public $notex; 45 | public $notdir; 46 | function __construct(){ 47 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 48 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 49 | if ($_GET['dir']) { 50 | foreach ($this->notdir as $key => $value) { 51 | if(strtolower($_GET['dir'])==$value){ 52 | $_GET['dir']="."; 53 | } 54 | } 55 | $tom=trim($_GET['dir']); 56 | $tam=str_replace("..", ".", $tom); 57 | $this->dir="./".$tam; 58 | }else{ 59 | $this->dir="."; 60 | } 61 | } 62 | function open_dir(){ 63 | if(is_dir($this->dir)){ 64 | if($dh=opendir($this->dir)){ 65 | while(($file=readdir($dh))!==false){ 66 | $this->jugg($file); 67 | } 68 | sort($this->file); 69 | sort($this->dirdir); 70 | closedir($dh); 71 | } 72 | }else{ 73 | echo "error"; 74 | } 75 | } 76 | function jugg($jugg){ 77 | if($jugg!="."&&$jugg!=".."){ 78 | if (is_dir($this->dir."/".$jugg)) { 79 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 80 | $this->dirdir[]=$this->dir."/".$jugg; 81 | } 82 | }else{ 83 | $ex=array_pop(explode(".", $jugg)); 84 | if(!in_array(strtolower($ex), $this->notex)){ 85 | $this->file[]=$this->dir."/".$jugg; 86 | } 87 | } 88 | } 89 | } 90 | function dirurl($dir){ 91 | $urf=substr($dir,2 ); 92 | return "?dir=".rawurlencode($urf); 93 | } 94 | function value($value){ 95 | $urf=substr($value,2 ); 96 | return $urf; 97 | } 98 | function type($file){ 99 | $ex=strtolower(array_pop(explode(".", $file))); 100 | switch ($ex) { 101 | case 'png': 102 | case 'jpg': 103 | case 'gif': 104 | case 'bmp': 105 | case 'jpeg': 106 | return "img"; 107 | break; 108 | case 'torrent': 109 | return "torrent"; 110 | break; 111 | case 'mp3': 112 | return "mp3"; 113 | break; 114 | case 'mp4': 115 | case 'ogg': 116 | case 'webm': 117 | return "video"; 118 | break; 119 | case 'xls': 120 | case 'xlsx': 121 | case 'doc': 122 | case 'docx': 123 | case 'ppt': 124 | case 'pptx': 125 | return "other"; 126 | break; 127 | case 'pdf': 128 | return "pdf"; 129 | break; 130 | case 'txt': 131 | case 'json': 132 | case 'xml': 133 | case 'html': 134 | case 'md': 135 | return "text"; 136 | break; 137 | default: 138 | return "other"; 139 | break; 140 | } 141 | } 142 | function download($file){ 143 | return ""; 144 | } 145 | function other($file){ 146 | 147 | 148 | } 149 | function img($img){ 150 | 151 | } 152 | function pdf($pdf){ 153 | 154 | } 155 | function video($video){ 156 | 157 | } 158 | function mp3($mp3){ 159 | 160 | } 161 | function torrent($torrent){ 162 | 163 | } 164 | function filename($file){ 165 | return array_pop(explode("/", $file)); 166 | } 167 | function text($file){ 168 | 169 | } 170 | function size($file){ 171 | $fz=filesize($file); 172 | if ($fz>(1024*1024*1024)) { 173 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 174 | }elseif ($fz>(1024*1024)) { 175 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 176 | }elseif($fz>1024){ 177 | return sprintf("%.2f",$fz/1024)."KB"; 178 | }else{ 179 | return $fz."B"; 180 | } 181 | } 182 | function mtime($file){ 183 | return date("Y-m-d H:i:s",filemtime($file)); 184 | } 185 | function atime($file){ 186 | return date("Y-m-d H:i:s",fileatime($file)); 187 | } 188 | function ctime($file){ 189 | return date("Y-m-d H:i:s",filectime($file)); 190 | 191 | } 192 | function icon($file){ 193 | $ex=strtolower(array_pop(explode(".", $file))); 194 | switch ($ex) { 195 | case 'png': 196 | case 'jpg': 197 | case 'gif': 198 | case 'bmp': 199 | case 'jpeg': 200 | return "glyphicon glyphicon-picture"; 201 | break; 202 | case 'torrent': 203 | return "glyphicon glyphicon-magnet"; 204 | break; 205 | case 'mp3': 206 | return "glyphicon glyphicon-music"; 207 | break; 208 | case 'mp4': 209 | case 'ogg': 210 | case 'webm': 211 | return "glyphicon glyphicon-film"; 212 | break; 213 | case 'xls': 214 | case 'xlsx': 215 | case 'doc': 216 | case 'docx': 217 | case 'ppt': 218 | case 'pptx': 219 | return "glyphicon glyphicon-pencil"; 220 | break; 221 | case 'pdf': 222 | return "glyphicon glyphicon-book"; 223 | break; 224 | case 'txt': 225 | case 'md': 226 | return "glyphicon glyphicon-file"; 227 | break; 228 | default: 229 | return "glyphicon glyphicon-stop"; 230 | break; 231 | } 232 | } 233 | function pre(){ 234 | $dir_array=explode("/", $this->dir); 235 | $num=count($dir_array); 236 | if($num>=2){ 237 | @array_shift($dir_array); 238 | $url="/."; 239 | foreach ($dir_array as $key => $value) { 240 | $step=$step.$value."/"; 241 | $url=$url."/".$value.""; 242 | } 243 | return $url; 244 | } 245 | 246 | } 247 | } 248 | /** 249 | * 250 | */ 251 | class json{ 252 | public $info; 253 | function __construct(){ 254 | if(is_file("./info.json")){ 255 | $swap=file_get_contents("./info.json"); 256 | $this->info=json_decode($swap,true); 257 | }else{ 258 | $this->info=array("data"=>"json","gid"=>"","gid_info"=>"","this_num"=>"","this_time"=>"","hash"=>"","hash_info"=>"");//infoHash 259 | $aj=json_encode($this->info); 260 | @file_put_contents("./info.json", $aj); 261 | } 262 | } 263 | function gid($gid){ 264 | return in_array($gid, $this->info['gid']); 265 | } 266 | function hash($hash){ 267 | return in_array($hash, $this->info['hash']); 268 | } 269 | function add_hash($info){ 270 | if($info["result"]['infoHash']){ 271 | $this->info['hash'][]=$info["result"]['infoHash']; 272 | $iof['time']=time(); 273 | $iof['gid']=$info["result"]['gid']; 274 | $iof['hash']=$info["result"]['infoHash']; 275 | $this->info['hash_info'][]=$iof; 276 | $this->save(); 277 | } 278 | 279 | } 280 | function add($gid){ 281 | $this->add_num(); 282 | $this->add_gid($gid); 283 | $this->save(); 284 | } 285 | function save(){ 286 | $save=json_encode($this->info); 287 | @file_put_contents("./info.json", $save); 288 | 289 | } 290 | function add_num(){ 291 | $this->info['this_time']=time(); 292 | $this->info['this_num']+=1; 293 | } 294 | function add_gid($gid){ 295 | $ar[$gid]['time']=time(); 296 | $ar[$gid]['gid']=$gid; 297 | $this->info['gid_info'][]=$ar; 298 | $this->info['gid'][]=$gid; 299 | } 300 | function jugg(){ 301 | $today=date("Ymd"); 302 | $month=date("Ym"); 303 | if(strtolower(TYPE)=="d"){ 304 | if($today==date("Ymd",$this->info['this_time'])){ 305 | if(NUM>$this->info['this_num']){ 306 | return true; 307 | }else{ 308 | return false; 309 | } 310 | }else{ 311 | $this->info['this_num']=0; 312 | return true; 313 | } 314 | }elseif (strtolower(TYPE)=="m") { 315 | if($month==date("Ym",$this->info['this_time'])){ 316 | if(NUM>$this->info['this_num']){ 317 | return true; 318 | }else{ 319 | return false; 320 | } 321 | }else{ 322 | $this->info['this_num']=0; 323 | return true; 324 | } 325 | 326 | }else{ 327 | if($today==date("Ymd",$this->info['this_time'])){ 328 | if(NUM<$this->info['this_num']){ 329 | return true; 330 | }else{ 331 | return false; 332 | } 333 | }else{ 334 | $this->info['this_num']=0; 335 | return true; 336 | } 337 | } 338 | } 339 | } 340 | function size($fz){ 341 | if ($fz>(1024*1024*1024)) { 342 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 343 | }elseif ($fz>(1024*1024)) { 344 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 345 | }elseif($fz>1024){ 346 | return sprintf("%.2f",$fz/1024)."KB"; 347 | }else{ 348 | return $fz."B"; 349 | } 350 | } 351 | 352 | session_start(); 353 | $download_info=new json(); 354 | if ($_SESSION['user']) { 355 | if (strlen($_GET['url'])>5) {//验证session才能添加操作 356 | $download_jugg=$download_info->jugg(); 357 | if($download_jugg){ 358 | $url=$_GET['url']; 359 | $dir=dirname(__FILE__); 360 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 361 | $json=$aria2->addUri(array($url),array('dir'=>$dir,)); 362 | $download_info->add($json['result']); 363 | echo json_encode($json); 364 | $gh=$aria2->tellStatus($json['result']); 365 | $download_info->add_hash($gh); 366 | return; 367 | }else{ 368 | $ar['error']['message']="今日配额已经使用完"; 369 | echo json_encode($ar); 370 | return; 371 | } 372 | } 373 | } 374 | 375 | 376 | $x=new dir(); 377 | $x->open_dir(); 378 | ?> 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | Webdir 394 | 404 | 405 | 406 | 413 |
414 |
415 |
416 |

Webdir

417 |
418 |
419 |
420 |
421 | 422 | 423 | 424 | 425 |
426 |
427 |
428 |
429 | 430 |
431 | 5){ 439 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 440 | $aria2->pause($_GET['pause']); 441 | header("Location:".$_SERVER['HTTP_REFERER']); 442 | return; 443 | } 444 | if(strlen($_GET['unpause'])>5){ 445 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 446 | $aria2->unpause($_GET['unpause']); 447 | header("Location:".$_SERVER['HTTP_REFERER']); 448 | return; 449 | } 450 | ?> 451 |
452 |
453 |
454 |

458 |
459 |
460 |

461 | pre() ; 463 | ?> 464 |

465 |
466 |
467 |
468 | 469 | 470 | Magnet 471 | 下载列表 472 | 473 |
474 |
475 |
476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | dirdir as $key => $value) { 485 | echo ""; 486 | echo ""; 487 | echo ""; 488 | echo ""; 489 | echo ""; 490 | echo ""; 491 | } 492 | foreach ($x->file as $key => $value) { 493 | echo ""; 494 | echo ""; 495 | echo ""; 496 | echo ""; 497 | echo ""; 498 | echo ""; 499 | } 500 | ?> 501 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
502 |
503 | Powered by webdir 504 |
505 |
506 | 磁盘信息: 507 |
508 |
509 |
" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;"> 522 | % 523 |
524 |
525 |
526 |
527 |
528 | 529 | USED: / FREE: / TOTAL: 530 | 531 |
532 | 533 |
534 |
535 | 549 |
550 |
551 | 下载中的任务 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | tellActive(); 562 | foreach ($info['result'] as $key => $value) { 563 | if ((!$download_info->gid($value['gid'])) && (!$download_info->hash($value['infoHash']))) { 564 | continue; 565 | } 566 | echo ""; 567 | echo ""; 568 | echo ""; 569 | echo ""; 570 | } 571 | ?> 572 |
文件名下载速度完成率操作
".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%关闭
573 |
574 | 等待中的任务 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | tellWaiting(0,1000); 584 | foreach ($info['result'] as $key => $value) { 585 | if ((!$download_info->gid($value['gid'])) && (!$download_info->hash($value['infoHash']))) { 586 | continue; 587 | } 588 | //echo ""; 589 | echo ""; 590 | echo ""; 591 | echo ""; 592 | echo ""; 593 | } 594 | ?> 595 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%开始
596 |
597 | 598 | 599 | 667 | 668 | 669 | -------------------------------------------------------------------------------- /moreinfo.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 14 | curl_setopt_array($this->ch, [ 15 | CURLOPT_POST=>true, 16 | CURLOPT_RETURNTRANSFER=>true, 17 | CURLOPT_HEADER=>false 18 | ]); 19 | } 20 | function __destruct(){ 21 | curl_close($this->ch); 22 | } 23 | protected function req($data){ 24 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 25 | return curl_exec($this->ch); 26 | } 27 | function __call($name, $arg){ 28 | $data = [ 29 | 'jsonrpc'=>'2.0', 30 | 'id'=>'1', 31 | 'method'=>'aria2.'.$name, 32 | 'params'=>$arg 33 | ]; 34 | $data = json_encode($data); 35 | $response = $this->req($data); 36 | if($response===false) { 37 | trigger_error(curl_error($this->ch)); 38 | } 39 | return json_decode($response, 1); 40 | } 41 | } 42 | class dir{ 43 | public $dir; 44 | public $file; 45 | public $dirdir; 46 | public $notex; 47 | public $notdir; 48 | function __construct(){ 49 | $this->notex=array("php","js","tgz","json");//不允许显示的后缀名文件 50 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 51 | if ($_GET['dir']) { 52 | foreach ($this->notdir as $key => $value) { 53 | if(strtolower($_GET['dir'])==$value){ 54 | $_GET['dir']="."; 55 | } 56 | } 57 | $tom=trim($_GET['dir']); 58 | $tam=str_replace("..", ".", $tom); 59 | $this->dir="./".$tam; 60 | }else{ 61 | $this->dir="."; 62 | } 63 | } 64 | function open_dir(){ 65 | if(is_dir($this->dir)){ 66 | if($dh=opendir($this->dir)){ 67 | while(($file=readdir($dh))!==false){ 68 | $this->jugg($file); 69 | } 70 | sort($this->file); 71 | sort($this->dirdir); 72 | closedir($dh); 73 | } 74 | }else{ 75 | echo "error"; 76 | } 77 | } 78 | function jugg($jugg){ 79 | if($jugg!="."&&$jugg!=".."){ 80 | if (is_dir($this->dir."/".$jugg)) { 81 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 82 | $this->dirdir[]=$this->dir."/".$jugg; 83 | } 84 | }else{ 85 | $ex=array_pop(explode(".", $jugg)); 86 | if(!in_array(strtolower($ex), $this->notex)){ 87 | $this->file[]=$this->dir."/".$jugg; 88 | } 89 | } 90 | } 91 | } 92 | function dirurl($dir){ 93 | $urf=substr($dir,2 ); 94 | return "?dir=".rawurlencode($urf); 95 | } 96 | function value($value){ 97 | $urf=substr($value,2 ); 98 | return $urf; 99 | } 100 | function type($file){ 101 | $ex=strtolower(array_pop(explode(".", $file))); 102 | switch ($ex) { 103 | case 'png': 104 | case 'jpg': 105 | case 'gif': 106 | case 'bmp': 107 | case 'jpeg': 108 | return "img"; 109 | break; 110 | case 'torrent': 111 | return "torrent"; 112 | break; 113 | case 'mp3': 114 | return "mp3"; 115 | break; 116 | case 'mp4': 117 | case 'ogg': 118 | case 'webm': 119 | return "video"; 120 | break; 121 | case 'xls': 122 | case 'xlsx': 123 | case 'doc': 124 | case 'docx': 125 | case 'ppt': 126 | case 'pptx': 127 | return "other"; 128 | break; 129 | case 'pdf': 130 | return "pdf"; 131 | break; 132 | case 'txt': 133 | case 'json': 134 | case 'xml': 135 | case 'html': 136 | case 'md': 137 | return "text"; 138 | break; 139 | default: 140 | return "other"; 141 | break; 142 | } 143 | } 144 | function download($file){ 145 | return ""; 146 | } 147 | function other($file){ 148 | 149 | 150 | } 151 | function img($img){ 152 | 153 | } 154 | function pdf($pdf){ 155 | 156 | } 157 | function video($video){ 158 | 159 | } 160 | function mp3($mp3){ 161 | 162 | } 163 | function torrent($torrent){ 164 | 165 | } 166 | function filename($file){ 167 | return array_pop(explode("/", $file)); 168 | } 169 | function text($file){ 170 | 171 | } 172 | function size($file){ 173 | $fz=filesize($file); 174 | if ($fz>(1024*1024*1024)) { 175 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 176 | }elseif ($fz>(1024*1024)) { 177 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 178 | }elseif($fz>1024){ 179 | return sprintf("%.2f",$fz/1024)."KB"; 180 | }else{ 181 | return $fz."B"; 182 | } 183 | } 184 | function mtime($file){ 185 | return date("Y-m-d H:i:s",filemtime($file)); 186 | } 187 | function atime($file){ 188 | return date("Y-m-d H:i:s",fileatime($file)); 189 | } 190 | function ctime($file){ 191 | return date("Y-m-d H:i:s",filectime($file)); 192 | 193 | } 194 | function icon($file){ 195 | $ex=strtolower(array_pop(explode(".", $file))); 196 | switch ($ex) { 197 | case 'png': 198 | case 'jpg': 199 | case 'gif': 200 | case 'bmp': 201 | case 'jpeg': 202 | return "glyphicon glyphicon-picture"; 203 | break; 204 | case 'torrent': 205 | return "glyphicon glyphicon-magnet"; 206 | break; 207 | case 'mp3': 208 | return "glyphicon glyphicon-music"; 209 | break; 210 | case 'mp4': 211 | case 'ogg': 212 | case 'webm': 213 | return "glyphicon glyphicon-film"; 214 | break; 215 | case 'xls': 216 | case 'xlsx': 217 | case 'doc': 218 | case 'docx': 219 | case 'ppt': 220 | case 'pptx': 221 | return "glyphicon glyphicon-pencil"; 222 | break; 223 | case 'pdf': 224 | return "glyphicon glyphicon-book"; 225 | break; 226 | case 'txt': 227 | case 'md': 228 | return "glyphicon glyphicon-file"; 229 | break; 230 | default: 231 | return "glyphicon glyphicon-stop"; 232 | break; 233 | } 234 | } 235 | function pre(){ 236 | $dir_array=explode("/", $this->dir); 237 | $num=count($dir_array); 238 | if($num>=2){ 239 | @array_shift($dir_array); 240 | $url="/."; 241 | foreach ($dir_array as $key => $value) { 242 | $step=$step.$value."/"; 243 | $url=$url."/".$value.""; 244 | } 245 | return $url; 246 | } 247 | 248 | } 249 | } 250 | /** 251 | * 252 | */ 253 | class json{ 254 | public $info; 255 | function __construct(){ 256 | if(is_file("./info.json")){ 257 | $swap=file_get_contents("./info.json"); 258 | $this->info=json_decode($swap,true); 259 | }else{ 260 | $this->info=array("data"=>"json","gid"=>"","gid_info"=>"","this_num"=>"","this_time"=>"","hash"=>"","hash_info"=>"","length"=>"");//infoHash 261 | $aj=json_encode($this->info); 262 | @file_put_contents("./info.json", $aj); 263 | } 264 | } 265 | function gid($gid){ 266 | return in_array($gid, $this->info['gid']); 267 | } 268 | function hash($hash){ 269 | return in_array($hash, $this->info['hash']); 270 | } 271 | function add_hash($info){ 272 | if($info["result"]['infoHash']){ 273 | $this->info['hash'][]=$info["result"]['infoHash']; 274 | $iof['time']=time(); 275 | $iof['gid']=$info["result"]['gid']; 276 | $iof['hash']=$info["result"]['infoHash']; 277 | $this->info['hash_info'][]=$iof; 278 | $this->save(); 279 | } 280 | 281 | } 282 | function add($gid){ 283 | $this->add_num(); 284 | $this->add_gid($gid); 285 | $this->save(); 286 | } 287 | function save(){ 288 | $save=json_encode($this->info); 289 | @file_put_contents("./info.json", $save); 290 | } 291 | function add_num(){ 292 | $this->info['this_time']=time(); 293 | $this->info['this_num']+=1; 294 | } 295 | function add_gid($gid){ 296 | $ar[$gid]['time']=time(); 297 | $ar[$gid]['gid']=$gid; 298 | $this->info['gid_info'][$gid]=$ar; 299 | $this->info['gid'][]=$gid; 300 | } 301 | function jugg(){ 302 | $today=date("Ymd"); 303 | $month=date("Ym"); 304 | if(strtolower(TYPE)=="d"){ 305 | if($today==date("Ymd",$this->info['this_time'])){ 306 | if(NUM>$this->info['this_num']){ 307 | return true; 308 | }else{ 309 | return false; 310 | } 311 | }else{ 312 | $this->info['this_num']=0; 313 | return true; 314 | } 315 | }elseif (strtolower(TYPE)=="m") { 316 | if($month==date("Ym",$this->info['this_time'])){ 317 | if(NUM>$this->info['this_num']){ 318 | return true; 319 | }else{ 320 | return false; 321 | } 322 | }else{ 323 | $this->info['this_num']=0; 324 | return true; 325 | } 326 | 327 | }else{ 328 | if($today==date("Ymd",$this->info['this_time'])){ 329 | if(NUM<$this->info['this_num']){ 330 | return true; 331 | }else{ 332 | return false; 333 | } 334 | }else{ 335 | $this->info['this_num']=0; 336 | return true; 337 | } 338 | } 339 | } 340 | function length($info){ 341 | $gid=$info['gid']; 342 | if ($info['totalLength']>MAX*pow(2, 30)) { 343 | return $info['gid'];//过大 344 | } 345 | if (!$this->info['gid_info'][$gid]['length']) { 346 | $this->info['gid_info'][$gid]['length']=$info['totalLength']; 347 | $this->info['length']+=$info['totalLength']; 348 | $this->save(); 349 | } 350 | } 351 | } 352 | function size($fz){ 353 | if ($fz>(1024*1024*1024)) { 354 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 355 | }elseif ($fz>(1024*1024)) { 356 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 357 | }elseif($fz>1024){ 358 | return sprintf("%.2f",$fz/1024)."KB"; 359 | }else{ 360 | return $fz."B"; 361 | } 362 | } 363 | 364 | session_start(); 365 | $download_info=new json(); 366 | if ($_SESSION['user']) { 367 | if (strlen($_GET['url'])>5) {//验证session才能添加操作 368 | $download_jugg=$download_info->jugg(); 369 | if($download_info->info['length']>DISK*pow(2, 30)){ 370 | $ar['error']['message']="账户分配的磁盘已满!请联系管理员。"; 371 | echo json_encode($ar); 372 | return; 373 | } 374 | if($download_jugg){ 375 | $url=trim($_GET['url']); 376 | $dir=dirname(__FILE__); 377 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 378 | $json=$aria2->addUri(array($url),array('dir'=>$dir,)); 379 | $download_info->add($json['result']); 380 | echo json_encode($json); 381 | $gh=$aria2->tellStatus($json['result']); 382 | $download_info->add_hash($gh); 383 | return; 384 | }else{ 385 | $ar['error']['message']="今日配额已经使用完"; 386 | echo json_encode($ar); 387 | return; 388 | } 389 | } 390 | } 391 | 392 | 393 | $x=new dir(); 394 | $x->open_dir(); 395 | ?> 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | Webdir 411 | 421 | 422 | 423 | 430 |
431 |
432 |
433 |

Webdir

434 |
435 |
436 |
437 |
438 | 439 | 440 | 441 | 442 |
443 |
444 |
445 |
446 | 447 |
448 | info['length']; 453 | $free=$total-$used;//disk 454 | $usp=round($used/$total*100,2);//used % 455 | if(strlen($_GET['pause'])>5){ 456 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 457 | $aria2->pause($_GET['pause']); 458 | header("Location:".$_SERVER['HTTP_REFERER']); 459 | return; 460 | } 461 | if(strlen($_GET['unpause'])>5){ 462 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 463 | $aria2->unpause($_GET['unpause']); 464 | header("Location:".$_SERVER['HTTP_REFERER']); 465 | return; 466 | } 467 | ?> 468 |
469 |
470 |
471 |

475 |
476 |
477 |

478 | pre() ; 480 | ?> 481 |

482 |
483 |
484 |
485 | 486 | 487 | Magnet 488 | 下载列表 489 | 490 |
491 |
492 |
493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | dirdir as $key => $value) { 502 | echo ""; 503 | echo ""; 504 | echo ""; 505 | echo ""; 506 | echo ""; 507 | echo ""; 508 | } 509 | foreach ($x->file as $key => $value) { 510 | echo ""; 511 | echo ""; 512 | echo ""; 513 | echo ""; 514 | echo ""; 515 | echo ""; 516 | } 517 | ?> 518 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
519 |
520 | Powered by webdir 521 |
522 |
523 | 空间信息: 524 |
525 |
526 |
" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;"> 539 | % 540 |
541 |
542 |
543 |
544 |
545 | 546 | USED: / FREE: / TOTAL: 547 | 548 |
549 | 550 |
551 |
552 | 566 |
567 |
568 | 下载中的任务 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | tellActive(); 579 | foreach ($info['result'] as $key => $value) { 580 | if ((!$download_info->gid($value['gid'])) && (!$download_info->hash($value['infoHash']))) { 581 | continue; 582 | } 583 | echo ""; 584 | echo ""; 585 | echo ""; 586 | echo ""; 587 | $do_file=$download_info->length($value); 588 | if ($do_file) { 589 | $aria2->remove($do_file); 590 | } 591 | } 592 | ?> 593 |
文件名下载速度完成率操作
".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%关闭
594 |
595 | 等待中的任务 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | tellWaiting(0,100); 605 | foreach ($info['result'] as $key => $value) { 606 | if ((!$download_info->gid($value['gid'])) && (!$download_info->hash($value['infoHash']))) { 607 | continue; 608 | } 609 | //echo ""; 610 | echo ""; 611 | echo ""; 612 | echo ""; 613 | echo ""; 614 | $do_file=$download_info->length($value); 615 | if ($do_file) { 616 | $aria2->remove($do_file); 617 | } 618 | } 619 | ?> 620 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%开始
621 |
622 | 623 | 624 | 692 | 693 | 694 | tellStopped(0,6000); 697 | foreach ($info['result'] as $key => $value) { 698 | if ((!$download_info->gid($value['gid'])) && (!$download_info->hash($value['infoHash']))) { 699 | continue; 700 | } 701 | $do_file=$download_info->length($value); 702 | if ($do_file) { 703 | $aria2->remove($do_file); 704 | } 705 | } 706 | 707 | 708 | ?> 709 | -------------------------------------------------------------------------------- /wadir-ajax.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 10 | curl_setopt_array($this->ch, [ 11 | CURLOPT_POST=>true, 12 | CURLOPT_RETURNTRANSFER=>true, 13 | CURLOPT_HEADER=>false 14 | ]); 15 | } 16 | function __destruct(){ 17 | curl_close($this->ch); 18 | } 19 | protected function req($data){ 20 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 21 | return curl_exec($this->ch); 22 | } 23 | function __call($name, $arg){ 24 | $data = [ 25 | 'jsonrpc'=>'2.0', 26 | 'id'=>'1', 27 | 'method'=>'aria2.'.$name, 28 | 'params'=>$arg 29 | ]; 30 | $data = json_encode($data); 31 | $response = $this->req($data); 32 | if($response===false) { 33 | trigger_error(curl_error($this->ch)); 34 | } 35 | return json_decode($response, 1); 36 | } 37 | } 38 | class dir{ 39 | public $dir; 40 | public $file; 41 | public $dirdir; 42 | public $notex; 43 | public $notdir; 44 | function __construct(){ 45 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 46 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 47 | if (isset($_GET['dir'])) { 48 | foreach ($this->notdir as $key => $value) { 49 | if(strtolower($_GET['dir'])==$value){ 50 | $_GET['dir']="."; 51 | } 52 | } 53 | $tom=trim($_GET['dir']); 54 | $tam=str_replace("..", ".", $tom); 55 | $this->dir="./".$tam; 56 | }else{ 57 | $this->dir="."; 58 | } 59 | } 60 | function open_dir(){ 61 | if(is_dir($this->dir)){ 62 | if($dh=opendir($this->dir)){ 63 | while(($file=readdir($dh))!==false){ 64 | $this->jugg($file); 65 | } 66 | if(count($this->file)>=1){ 67 | sort($this->file); 68 | } 69 | if(count($this->dirdir)>=1){ 70 | sort($this->dirdir); 71 | } 72 | closedir($dh); 73 | } 74 | }else{ 75 | echo "error"; 76 | } 77 | } 78 | function jugg($jugg){ 79 | if($jugg!="."&&$jugg!=".."){ 80 | if (is_dir($this->dir."/".$jugg)) { 81 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 82 | $this->dirdir[]=$this->dir."/".$jugg; 83 | } 84 | }else{ 85 | $ex=$this->ex($jugg); 86 | if(!in_array($ex, $this->notex)){ 87 | $this->file[]=$this->dir."/".$jugg; 88 | } 89 | } 90 | } 91 | } 92 | function dirurl($dir){ 93 | $urf=substr($dir,2 ); 94 | return "?dir=".rawurlencode($urf); 95 | } 96 | function value($value){ 97 | $urf=substr($value,2 ); 98 | return $urf; 99 | } 100 | function type($file){ 101 | $ex=$this->ex($file); 102 | switch ($ex) { 103 | case 'png': 104 | case 'jpg': 105 | case 'gif': 106 | case 'bmp': 107 | case 'jpeg': 108 | return "img"; 109 | break; 110 | case 'torrent': 111 | return "torrent"; 112 | break; 113 | case 'mp3': 114 | return "mp3"; 115 | break; 116 | case 'mp4': 117 | case 'ogg': 118 | case 'webm': 119 | return "video"; 120 | break; 121 | case 'xls': 122 | case 'xlsx': 123 | case 'doc': 124 | case 'docx': 125 | case 'ppt': 126 | case 'pptx': 127 | return "other"; 128 | break; 129 | case 'pdf': 130 | return "pdf"; 131 | break; 132 | case 'txt': 133 | case 'json': 134 | case 'xml': 135 | case 'html': 136 | case 'md': 137 | return "text"; 138 | break; 139 | default: 140 | return "other"; 141 | break; 142 | } 143 | } 144 | function download($file){ 145 | return ""; 146 | } 147 | function other($file){ 148 | 149 | 150 | } 151 | function img($img){ 152 | 153 | } 154 | function pdf($pdf){ 155 | 156 | } 157 | function video($video){ 158 | 159 | } 160 | function mp3($mp3){ 161 | 162 | } 163 | function torrent($torrent){ 164 | 165 | } 166 | function filename($file){ 167 | $file_array=explode("/", $file); 168 | return array_pop($file_array); 169 | } 170 | function text($file){ 171 | 172 | } 173 | function size($file){ 174 | $fz=filesize($file); 175 | if ($fz>(1024*1024*1024)) { 176 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 177 | }elseif ($fz>(1024*1024)) { 178 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 179 | }elseif($fz>1024){ 180 | return sprintf("%.2f",$fz/1024)."KB"; 181 | }else{ 182 | return $fz."B"; 183 | } 184 | } 185 | function mtime($file){ 186 | return date("Y-m-d H:i:s",filemtime($file)); 187 | } 188 | function atime($file){ 189 | return date("Y-m-d H:i:s",fileatime($file)); 190 | } 191 | function ctime($file){ 192 | return date("Y-m-d H:i:s",filectime($file)); 193 | 194 | } 195 | function ex($file){ 196 | $file_array=explode(".", $file); 197 | $ex_n=array_pop($file_array); 198 | $ex=strtolower($ex_n); 199 | return $ex; 200 | } 201 | function icon($file){ 202 | $ex=$this->ex($file); 203 | switch ($ex) { 204 | case 'png': 205 | case 'jpg': 206 | case 'gif': 207 | case 'bmp': 208 | case 'jpeg': 209 | return "glyphicon glyphicon-picture"; 210 | break; 211 | case 'torrent': 212 | return "glyphicon glyphicon-magnet"; 213 | break; 214 | case 'mp3': 215 | return "glyphicon glyphicon-music"; 216 | break; 217 | case 'mp4': 218 | case 'ogg': 219 | case 'webm': 220 | return "glyphicon glyphicon-film"; 221 | break; 222 | case 'xls': 223 | case 'xlsx': 224 | case 'doc': 225 | case 'docx': 226 | case 'ppt': 227 | case 'pptx': 228 | return "glyphicon glyphicon-pencil"; 229 | break; 230 | case 'pdf': 231 | return "glyphicon glyphicon-book"; 232 | break; 233 | case 'txt': 234 | case 'md': 235 | return "glyphicon glyphicon-file"; 236 | break; 237 | default: 238 | return "glyphicon glyphicon-stop"; 239 | break; 240 | } 241 | } 242 | function pre(){ 243 | $dir_array=explode("/", $this->dir); 244 | $num=count($dir_array); 245 | if($num>=2){ 246 | @array_shift($dir_array); 247 | $url="/."; 248 | foreach ($dir_array as $key => $value) { 249 | $step=$step.$value."/"; 250 | $url=$url."/".$value.""; 251 | } 252 | return $url; 253 | } 254 | 255 | } 256 | } 257 | function size($fz){ 258 | if ($fz>(1024*1024*1024)) { 259 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 260 | }elseif ($fz>(1024*1024)) { 261 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 262 | }elseif($fz>1024){ 263 | return sprintf("%.2f",$fz/1024)."KB"; 264 | }else{ 265 | return $fz."B"; 266 | } 267 | } 268 | 269 | session_start(); 270 | if (isset($_SESSION['user'])&&$_SESSION['user']==PASS) { 271 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 272 | if(isset($_GET['url'])){ 273 | $dir=dirname(__FILE__); 274 | $url=$_GET['url']; 275 | $json=$aria2->addUri(array($url),array('dir'=>$dir,)); 276 | echo json_encode($json); 277 | return; 278 | } 279 | if(isset($_GET['aria2'])){ 280 | $active=$aria2->tellActive(); 281 | $waiting=$aria2->tellWaiting(0,100); 282 | $info['active']=$active['result']; 283 | $info['waiting']=$waiting['result']; 284 | echo json_encode($info); 285 | return; 286 | } 287 | if(isset($_GET['pause'])){ 288 | $info=$aria2->pause($_GET['pause']); 289 | echo json_encode($info); 290 | return; 291 | } 292 | if(isset($_GET['unpause'])){ 293 | $info=$aria2->unpause($_GET['unpause']); 294 | echo json_encode($info); 295 | return; 296 | } 297 | if(isset($_GET['remove'])){ 298 | $info=$aria2->remove($_GET['remove']); 299 | echo json_encode($info); 300 | return; 301 | } 302 | } 303 | 304 | 305 | $x=new dir(); 306 | $x->open_dir(); 307 | ?> 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | Webdir 323 | 333 | 334 | 335 | 342 |
343 |
344 |
345 |

Webdir

346 |
347 |
348 |
349 |
350 | 351 | 352 | 353 | 354 |
355 |
356 |
357 |
358 | 359 |
360 | 368 |
369 |
370 |
371 |

375 |
376 |
377 |

378 | pre() ; 380 | ?> 381 |

382 |
383 |
384 |
385 | 386 | 387 | Magnet 388 | 下载列表 389 | 390 |
391 |
392 |
393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | dirdir)){ 403 | foreach ($x->dirdir as $key => $value) { 404 | echo ""; 405 | echo ""; 406 | echo ""; 407 | echo ""; 408 | echo ""; 409 | echo ""; 410 | } 411 | } 412 | if(isset($x->file)){ 413 | foreach ($x->file as $key => $value) { 414 | echo ""; 415 | echo ""; 416 | echo ""; 417 | echo ""; 418 | echo ""; 419 | echo ""; 420 | } 421 | } 422 | ?> 423 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
424 |
425 | Powered by webdir 426 |
427 |
428 | 磁盘信息: 429 |
430 |
431 |
" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;"> 444 | % 445 |
446 |
447 |
448 |
449 |
450 | 451 | USED: / FREE: / TOTAL: 452 | 453 |
454 | 455 |
456 |
457 | 471 |
472 | 514 | 699 | 700 | 701 | -------------------------------------------------------------------------------- /wadir-dplay.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 10 | curl_setopt_array($this->ch, [ 11 | CURLOPT_POST=>true, 12 | CURLOPT_RETURNTRANSFER=>true, 13 | CURLOPT_HEADER=>false 14 | ]); 15 | } 16 | function __destruct(){ 17 | curl_close($this->ch); 18 | } 19 | protected function req($data){ 20 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 21 | return curl_exec($this->ch); 22 | } 23 | function __call($name, $arg){ 24 | $data = [ 25 | 'jsonrpc'=>'2.0', 26 | 'id'=>'1', 27 | 'method'=>'aria2.'.$name, 28 | 'params'=>$arg 29 | ]; 30 | $data = json_encode($data); 31 | $response = $this->req($data); 32 | if($response===false) { 33 | trigger_error(curl_error($this->ch)); 34 | } 35 | return json_decode($response, 1); 36 | } 37 | } 38 | class dir{ 39 | public $dir; 40 | public $file; 41 | public $dirdir; 42 | public $notex; 43 | public $notdir; 44 | function __construct(){ 45 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 46 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 47 | if (isset($_GET['dir'])) { 48 | foreach ($this->notdir as $key => $value) { 49 | if(strtolower($_GET['dir'])==$value){ 50 | $_GET['dir']="."; 51 | } 52 | } 53 | $tom=trim($_GET['dir']); 54 | $tam=str_replace("..", ".", $tom); 55 | $this->dir="./".$tam; 56 | }else{ 57 | $this->dir="."; 58 | } 59 | } 60 | function ex($string){ 61 | $ar=explode(".", $string); 62 | $ex=array_pop($ar); 63 | return strtolower($ex); 64 | } 65 | function open_dir(){ 66 | if(is_dir($this->dir)){ 67 | if($dh=opendir($this->dir)){ 68 | while(($file=readdir($dh))!==false){ 69 | $this->jugg($file); 70 | } 71 | //sort($this->file); 72 | //sort($this->dirdir); 73 | closedir($dh); 74 | } 75 | }else{ 76 | echo "error"; 77 | } 78 | } 79 | function jugg($jugg){ 80 | if($jugg!="."&&$jugg!=".."){ 81 | if (is_dir($this->dir."/".$jugg)) { 82 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 83 | $this->dirdir[]=$this->dir."/".$jugg; 84 | } 85 | }else{ 86 | $ex=$this->ex($jugg); 87 | if(!in_array($ex, $this->notex)){ 88 | $this->file[]=$this->dir."/".$jugg; 89 | } 90 | } 91 | } 92 | } 93 | function dirurl($dir){ 94 | $urf=substr($dir,2 ); 95 | return "?dir=".rawurlencode($urf); 96 | } 97 | function value($value){ 98 | $urf=substr($value,2 ); 99 | return $urf; 100 | } 101 | function type($file){ 102 | $ex=$this->ex($file); 103 | switch ($ex) { 104 | case 'png': 105 | case 'jpg': 106 | case 'gif': 107 | case 'bmp': 108 | case 'jpeg': 109 | return "img"; 110 | break; 111 | case 'torrent': 112 | return "torrent"; 113 | break; 114 | case 'mp3': 115 | return "mp3"; 116 | break; 117 | case 'mp4': 118 | case 'ogg': 119 | case 'webm': 120 | return "video"; 121 | break; 122 | case 'xls': 123 | case 'xlsx': 124 | case 'doc': 125 | case 'docx': 126 | case 'ppt': 127 | case 'pptx': 128 | return "other"; 129 | break; 130 | case 'pdf': 131 | return "pdf"; 132 | break; 133 | case 'txt': 134 | case 'json': 135 | case 'xml': 136 | case 'html': 137 | case 'md': 138 | return "text"; 139 | break; 140 | default: 141 | return "other"; 142 | break; 143 | } 144 | } 145 | function download($file){ 146 | return ""; 147 | } 148 | function md5($file){ 149 | return md5_file($file); 150 | } 151 | function other($file){ 152 | 153 | 154 | } 155 | function img($img){ 156 | 157 | } 158 | function pdf($pdf){ 159 | 160 | } 161 | function video($video){ 162 | 163 | } 164 | function mp3($mp3){ 165 | 166 | } 167 | function torrent($torrent){ 168 | 169 | } 170 | function filename($file){ 171 | $ar=explode("/", $file); 172 | return array_pop($ar); 173 | } 174 | function text($file){ 175 | 176 | } 177 | function size($file){ 178 | $fz=filesize($file); 179 | if ($fz>(1024*1024*1024)) { 180 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 181 | }elseif ($fz>(1024*1024)) { 182 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 183 | }elseif($fz>1024){ 184 | return sprintf("%.2f",$fz/1024)."KB"; 185 | }else{ 186 | return $fz."B"; 187 | } 188 | } 189 | function mtime($file){ 190 | return date("Y-m-d H:i:s",filemtime($file)); 191 | } 192 | function atime($file){ 193 | return date("Y-m-d H:i:s",fileatime($file)); 194 | } 195 | function ctime($file){ 196 | return date("Y-m-d H:i:s",filectime($file)); 197 | 198 | } 199 | function icon($file){ 200 | $ex=$this->ex($file); 201 | switch ($ex) { 202 | case 'png': 203 | case 'jpg': 204 | case 'gif': 205 | case 'bmp': 206 | case 'jpeg': 207 | return "glyphicon glyphicon-picture"; 208 | break; 209 | case 'torrent': 210 | return "glyphicon glyphicon-magnet"; 211 | break; 212 | case 'mp3': 213 | return "glyphicon glyphicon-music"; 214 | break; 215 | case 'mp4': 216 | case 'ogg': 217 | case 'webm': 218 | return "glyphicon glyphicon-film"; 219 | break; 220 | case 'xls': 221 | case 'xlsx': 222 | case 'doc': 223 | case 'docx': 224 | case 'ppt': 225 | case 'pptx': 226 | return "glyphicon glyphicon-pencil"; 227 | break; 228 | case 'pdf': 229 | return "glyphicon glyphicon-book"; 230 | break; 231 | case 'txt': 232 | case 'md': 233 | return "glyphicon glyphicon-file"; 234 | break; 235 | default: 236 | return "glyphicon glyphicon-stop"; 237 | break; 238 | } 239 | } 240 | function pre(){ 241 | $dir_array=explode("/", $this->dir); 242 | $num=count($dir_array); 243 | if($num>=2){ 244 | @array_shift($dir_array); 245 | $url="/."; 246 | $step=""; 247 | foreach ($dir_array as $key => $value) { 248 | $step=$step.$value."/"; 249 | $url=$url."/".$value.""; 250 | } 251 | return $url; 252 | } 253 | 254 | } 255 | } 256 | function size($fz){ 257 | if ($fz>(1024*1024*1024)) { 258 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 259 | }elseif ($fz>(1024*1024)) { 260 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 261 | }elseif($fz>1024){ 262 | return sprintf("%.2f",$fz/1024)."KB"; 263 | }else{ 264 | return $fz."B"; 265 | } 266 | } 267 | 268 | session_start(); 269 | if ($_SESSION['user']==PASS) { 270 | $_GET['url']=isset($_GET['url'])?$_GET['url']:""; 271 | if (strlen($_GET['url'])>5) {//验证session才能添加操作 272 | $url=trim($_GET['url']); 273 | $dir=dirname(__FILE__); 274 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 275 | $json=$aria2->addUri(array($url),array('dir'=>$dir,)); 276 | echo json_encode($json); 277 | return; 278 | } 279 | } 280 | 281 | 282 | $x=new dir(); 283 | $x->open_dir(); 284 | ?> 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | Webdir 301 | 311 | 312 | 313 | 324 |
325 |
326 |
327 |

Webdir

328 |
329 |
330 |
331 |
332 | 333 | 334 | 335 | 336 |
337 |
338 |
339 |
340 | 341 |
342 | 5){ 351 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 352 | $aria2->pause($_GET['pause']); 353 | header("Location:".$_SERVER['HTTP_REFERER']); 354 | return; 355 | } 356 | $_GET['unpause']=isset($_GET['unpause'])?$_GET['unpause']:""; 357 | if(strlen($_GET['unpause'])>5){ 358 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 359 | $aria2->unpause($_GET['unpause']); 360 | header("Location:".$_SERVER['HTTP_REFERER']); 361 | return; 362 | } 363 | $_GET['remove']=isset($_GET['remove'])?$_GET['remove']:""; 364 | if(strlen($_GET['remove'])>5){ 365 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 366 | $aria2->remove($_GET['remove']); 367 | header("Location:".$_SERVER['HTTP_REFERER']); 368 | return; 369 | } 370 | 371 | ?> 372 |
373 |
374 |
375 | 377 | " 378 | >

379 |
380 |
381 |

382 | pre() ; 384 | ?> 385 |

386 |
387 |
388 |
389 | 390 | 391 | Magnet 392 | 下载列表 393 | 394 |
395 |
396 |
397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | dirdir as $key => $value) { 406 | echo ""; 407 | echo ""; 408 | echo ""; 409 | echo ""; 410 | echo ""; 411 | echo ""; 412 | } 413 | foreach ($x->file as $key => $value) { 414 | echo ""; 415 | echo ""; 416 | echo ""; 417 | echo ""; 418 | echo ""; 419 | echo ""; 420 | } 421 | ?> 422 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\" md5=\"".$x->md5($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
423 |
424 | Powered by webdir 425 |
426 |
427 | 磁盘信息: 428 |
429 |
430 |
" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;"> 443 | % 444 |
445 |
446 |
447 |
448 |
449 | 450 | USED: / FREE: / TOTAL: 451 | 452 |
453 | 454 |
455 |
456 | 470 |
471 |
472 | 正在下载的任务 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | tellActive(); 483 | foreach ($info['result'] as $key => $value) { 484 | //echo ""; 485 | echo ""; 486 | echo ""; 487 | echo ""; 488 | echo ""; 489 | } 490 | ?> 491 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%关闭 删除
492 |
493 | 等待中的任务 494 |
495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | tellWaiting(0,1000); 504 | foreach ($info['result'] as $key => $value) { 505 | //echo ""; 506 | echo ""; 507 | echo ""; 508 | echo ""; 509 | echo ""; 510 | } 511 | ?> 512 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%开始 删除
513 |
514 | 515 | 516 | 610 | 611 | 612 | -------------------------------------------------------------------------------- /wadir.php: -------------------------------------------------------------------------------- 1 | ch = curl_init($server); 10 | curl_setopt_array($this->ch, [ 11 | CURLOPT_POST=>true, 12 | CURLOPT_RETURNTRANSFER=>true, 13 | CURLOPT_HEADER=>false 14 | ]); 15 | } 16 | function __destruct(){ 17 | curl_close($this->ch); 18 | } 19 | protected function req($data){ 20 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); 21 | return curl_exec($this->ch); 22 | } 23 | function __call($name, $arg){ 24 | $data = [ 25 | 'jsonrpc'=>'2.0', 26 | 'id'=>'1', 27 | 'method'=>'aria2.'.$name, 28 | 'params'=>$arg 29 | ]; 30 | $data = json_encode($data); 31 | $response = $this->req($data); 32 | if($response===false) { 33 | trigger_error(curl_error($this->ch)); 34 | } 35 | return json_decode($response, 1); 36 | } 37 | } 38 | class dir{ 39 | public $dir; 40 | public $file; 41 | public $dirdir; 42 | public $notex; 43 | public $notdir; 44 | function __construct(){ 45 | $this->notex=array("php","js","tgz");//不允许显示的后缀名文件 46 | $this->notdir=array("a","phpmyadmin");//不允许显示的文件夹 47 | if ($_GET['dir']) { 48 | foreach ($this->notdir as $key => $value) { 49 | if(strtolower($_GET['dir'])==$value){ 50 | $_GET['dir']="."; 51 | } 52 | } 53 | $tom=trim($_GET['dir']); 54 | $tam=str_replace("..", ".", $tom); 55 | $this->dir="./".$tam; 56 | }else{ 57 | $this->dir="."; 58 | } 59 | } 60 | function open_dir(){ 61 | if(is_dir($this->dir)){ 62 | if($dh=opendir($this->dir)){ 63 | while(($file=readdir($dh))!==false){ 64 | $this->jugg($file); 65 | } 66 | sort($this->file); 67 | sort($this->dirdir); 68 | closedir($dh); 69 | } 70 | }else{ 71 | echo "error"; 72 | } 73 | } 74 | function jugg($jugg){ 75 | if($jugg!="."&&$jugg!=".."){ 76 | if (is_dir($this->dir."/".$jugg)) { 77 | if(!in_array(strtolower($this->filename($jugg)), $this->notdir)){ 78 | $this->dirdir[]=$this->dir."/".$jugg; 79 | } 80 | }else{ 81 | $ex=array_pop(explode(".", $jugg)); 82 | if(!in_array(strtolower($ex), $this->notex)){ 83 | $this->file[]=$this->dir."/".$jugg; 84 | } 85 | } 86 | } 87 | } 88 | function dirurl($dir){ 89 | $urf=substr($dir,2 ); 90 | return "?dir=".rawurlencode($urf); 91 | } 92 | function value($value){ 93 | $urf=substr($value,2 ); 94 | return $urf; 95 | } 96 | function type($file){ 97 | $ex=strtolower(array_pop(explode(".", $file))); 98 | switch ($ex) { 99 | case 'png': 100 | case 'jpg': 101 | case 'gif': 102 | case 'bmp': 103 | case 'jpeg': 104 | return "img"; 105 | break; 106 | case 'torrent': 107 | return "torrent"; 108 | break; 109 | case 'mp3': 110 | return "mp3"; 111 | break; 112 | case 'mp4': 113 | case 'ogg': 114 | case 'webm': 115 | return "video"; 116 | break; 117 | case 'xls': 118 | case 'xlsx': 119 | case 'doc': 120 | case 'docx': 121 | case 'ppt': 122 | case 'pptx': 123 | return "other"; 124 | break; 125 | case 'pdf': 126 | return "pdf"; 127 | break; 128 | case 'txt': 129 | case 'json': 130 | case 'xml': 131 | case 'html': 132 | case 'md': 133 | return "text"; 134 | break; 135 | default: 136 | return "other"; 137 | break; 138 | } 139 | } 140 | function download($file){ 141 | return ""; 142 | } 143 | function other($file){ 144 | 145 | 146 | } 147 | function img($img){ 148 | 149 | } 150 | function pdf($pdf){ 151 | 152 | } 153 | function video($video){ 154 | 155 | } 156 | function mp3($mp3){ 157 | 158 | } 159 | function torrent($torrent){ 160 | 161 | } 162 | function filename($file){ 163 | return array_pop(explode("/", $file)); 164 | } 165 | function text($file){ 166 | 167 | } 168 | function size($file){ 169 | $fz=filesize($file); 170 | if ($fz>(1024*1024*1024)) { 171 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 172 | }elseif ($fz>(1024*1024)) { 173 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 174 | }elseif($fz>1024){ 175 | return sprintf("%.2f",$fz/1024)."KB"; 176 | }else{ 177 | return $fz."B"; 178 | } 179 | } 180 | function mtime($file){ 181 | return date("Y-m-d H:i:s",filemtime($file)); 182 | } 183 | function atime($file){ 184 | return date("Y-m-d H:i:s",fileatime($file)); 185 | } 186 | function ctime($file){ 187 | return date("Y-m-d H:i:s",filectime($file)); 188 | 189 | } 190 | function icon($file){ 191 | $ex=strtolower(array_pop(explode(".", $file))); 192 | switch ($ex) { 193 | case 'png': 194 | case 'jpg': 195 | case 'gif': 196 | case 'bmp': 197 | case 'jpeg': 198 | return "glyphicon glyphicon-picture"; 199 | break; 200 | case 'torrent': 201 | return "glyphicon glyphicon-magnet"; 202 | break; 203 | case 'mp3': 204 | return "glyphicon glyphicon-music"; 205 | break; 206 | case 'mp4': 207 | case 'ogg': 208 | case 'webm': 209 | return "glyphicon glyphicon-film"; 210 | break; 211 | case 'xls': 212 | case 'xlsx': 213 | case 'doc': 214 | case 'docx': 215 | case 'ppt': 216 | case 'pptx': 217 | return "glyphicon glyphicon-pencil"; 218 | break; 219 | case 'pdf': 220 | return "glyphicon glyphicon-book"; 221 | break; 222 | case 'txt': 223 | case 'md': 224 | return "glyphicon glyphicon-file"; 225 | break; 226 | default: 227 | return "glyphicon glyphicon-stop"; 228 | break; 229 | } 230 | } 231 | function pre(){ 232 | $dir_array=explode("/", $this->dir); 233 | $num=count($dir_array); 234 | if($num>=2){ 235 | @array_shift($dir_array); 236 | $url="/."; 237 | foreach ($dir_array as $key => $value) { 238 | $step=$step.$value."/"; 239 | $url=$url."/".$value.""; 240 | } 241 | return $url; 242 | } 243 | 244 | } 245 | } 246 | function size($fz){ 247 | if ($fz>(1024*1024*1024)) { 248 | return sprintf("%.2f",$fz/(1024*1024*1024))."GB"; 249 | }elseif ($fz>(1024*1024)) { 250 | return sprintf("%.2f",$fz/(1024*1024))."MB"; 251 | }elseif($fz>1024){ 252 | return sprintf("%.2f",$fz/1024)."KB"; 253 | }else{ 254 | return $fz."B"; 255 | } 256 | } 257 | 258 | session_start(); 259 | if ($_SESSION['user']==PASS) { 260 | if (strlen($_GET['url'])>5) {//验证session才能添加操作 261 | $url=trim($_GET['url']); 262 | $dir=dirname(__FILE__); 263 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 264 | $json=$aria2->addUri(array($url),array('dir'=>$dir,)); 265 | echo json_encode($json); 266 | return; 267 | } 268 | } 269 | 270 | 271 | $x=new dir(); 272 | $x->open_dir(); 273 | ?> 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | Webdir 289 | 299 | 300 | 301 | 308 |
309 |
310 |
311 |

Webdir

312 |
313 |
314 |
315 |
316 | 317 | 318 | 319 | 320 |
321 |
322 |
323 |
324 | 325 |
326 | 5){ 334 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 335 | $aria2->pause($_GET['pause']); 336 | header("Location:".$_SERVER['HTTP_REFERER']); 337 | return; 338 | } 339 | if(strlen($_GET['unpause'])>5){ 340 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 341 | $aria2->unpause($_GET['unpause']); 342 | header("Location:".$_SERVER['HTTP_REFERER']); 343 | return; 344 | } 345 | if(strlen($_GET['remove'])>5){ 346 | $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); 347 | $aria2->remove($_GET['remove']); 348 | header("Location:".$_SERVER['HTTP_REFERER']); 349 | return; 350 | } 351 | 352 | ?> 353 |
354 |
355 |
356 |

360 |
361 |
362 |

363 | pre() ; 365 | ?> 366 |

367 |
368 |
369 |
370 | 371 | 372 | Magnet 373 | 下载列表 374 | 375 |
376 |
377 |
378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | dirdir as $key => $value) { 387 | echo ""; 388 | echo ""; 389 | echo ""; 390 | echo ""; 391 | echo ""; 392 | echo ""; 393 | } 394 | foreach ($x->file as $key => $value) { 395 | echo ""; 396 | echo ""; 397 | echo ""; 398 | echo ""; 399 | echo ""; 400 | echo ""; 401 | } 402 | ?> 403 |
文件名大小时间下载
dirurl($value)."\"> ".$x->filename($value)."目录".$x->mtime($value)."
icon($value)." fileshow\" type=\"".$x->type($value)."\" value=\"".$x->value($value)."\"> ".$x->filename($value)."".$x->size($value)."".$x->mtime($value)."".$x->download($value)."
404 |
405 | Powered by webdir 406 |
407 |
408 | 磁盘信息: 409 |
410 |
411 |
" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;"> 424 | % 425 |
426 |
427 |
428 |
429 |
430 | 431 | USED: / FREE: / TOTAL: 432 | 433 |
434 | 435 |
436 |
437 | 451 |
452 |
453 | 正在下载的任务 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | tellActive(); 464 | foreach ($info['result'] as $key => $value) { 465 | //echo ""; 466 | echo ""; 467 | echo ""; 468 | echo ""; 469 | echo ""; 470 | } 471 | ?> 472 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%关闭 删除
473 |
474 | 等待中的任务 475 |
476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | tellWaiting(0,1000); 485 | foreach ($info['result'] as $key => $value) { 486 | //echo ""; 487 | echo ""; 488 | echo ""; 489 | echo ""; 490 | echo ""; 491 | } 492 | ?> 493 |
文件名下载速度完成率操作
".$value['gid']."".$value['bittorrent']['info']['name']."".size($value['downloadSpeed'])."/S".round($value['completedLength']/$value['totalLength']*100,2)."%开始 删除
494 |
495 | 496 | 497 | 565 | 566 | 567 | --------------------------------------------------------------------------------