仰望星辰工作室

better-staridc-MNBT

better-staridc-MNBT/ user/wjxz.php 2.2 KB · 60 行 原始文件
Z zfhsh first commit 1 天前
1<?php
2include("../MPHX/common.php");
3@header('Content-Type: text/html; charset=UTF-8');
4if($islogins==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
5set_time_limit(0);
6ignore_user_abort();
7ini_set('memory_limit', '-1');
8?>
9<?php
10$gn=$_GET['dowtype'] ?? '';
11if($gn=='dowbtfile'){ //下载主机上的文件
12 $path=$_GET['filepath'] ?? '';
13 $name=$_GET['filename'] ?? '';
14 if(empty($path) || empty($name))exit('文件或目录为空!');
15 $cert=$DB->get_row_prepare("SELECT * FROM MN_bt WHERE btdh=? limit 1", [$ssbt]);
16 $btipe=($cert['ptl']=='true'?'https':'http').'://'.$cert['btip'].':'.$cert['btdk'];
17 $btkeye=$cert['btmy'];
18 if($cert['btos']=='1'){
19 $os_xt=$conf['hxi'].'/';
20 $l_ler_a='/etc/hosts';
21 }else{
22 $os_xt=$conf['hxo'].'/';
23 $l_ler_a='C:\Windows\System32\drivers\etc\hosts';
24 }
25 include("./class.php");
26 $api = new bt_api($btipe,$btkeye);
27 $filedata=$api->GetLogshqwjlo($os_xt.$yhc['sqldz'].$path); //获取指定目录下所有文件
28 $filelist=dirfiles($filedata['FILES'] ?? [],'file')['file'];
29 $file=false;
30 foreach($filelist as $val){
31 if($val['name']==$name){
32 $file=$val;
33 break;
34 }
35 }
36 if(!$file)exit('文件不存在!');
37 if($file['download']!=0){
38 //外链已经开启,获取外链
39 $data=$api->wailhq($file['download']) ?: [];
40 if(($data['password']??'')!=""){
41 //外链有密码,立刻关闭并且重新开启外链
42 $api->wailgb($file['download']);
43 $data=($api->wailkq($os_xt.$yhc['sqldz'].$path,$name) ?: [])['msg'] ?? '';
44 }
45 }else{
46 //外链未开启,开启外链
47 $data=$api->wailkq($os_xt.$yhc['sqldz'].$path,$name)['msg'];
48 }
49 $dowfile_url=$btipe.'/down/'.($data['token'] ?? '');
50
51 //以下为流量计算,下载文件所消耗的流量也记录为本月消耗流量。
52 $llzd=json_decode($yhc['llmax'],true);
53 $llzd['dq']+=$file['size'];
54 $llshiy=json_encode($llzd,256);
55 $DB->query_prepare("update `MN_zj` set `llmax`=? where `id`=?", [$llshiy, $yhid]);
56 //流量计算和写入结束
57
58 echo json_encode(['code'=>1,'msg'=>'下载文件','url'=>$dowfile_url],256);
59}
60?>