Skip to content

Commit

Permalink
新增 curl 及 mysqli 扩展未安装或未启用时的错误处理功能。
Browse files Browse the repository at this point in the history
  • Loading branch information
lc6464 committed Apr 3, 2021
1 parent bfed5a3 commit 3f210df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@
$DBPassword = (!empty($_POST["DBPassword"])) ? $_POST["DBPassword"] : "";
$dbname = (!empty($_POST["dbname"])) ? $_POST["dbname"] : "";
$dbtable = (!empty($_POST["dbtable"])) ? $_POST["dbtable"] : "";

if (!function_exists('mysqli_connect')) {
EchoInfo(-2, array("msg" => "<br/>您未安装或未启用 mysqli 扩展,<br/>不能使用数据库功能。<br/>请自行关闭数据库功能。"));
}
$conn = mysqli_connect($servername, $username, $DBPassword);
$GLOBALS['conn'] = $conn;
// Check connection
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function confirmdl(fs_id, timestamp, sign, randsk, share_id, uk, bdstoken, files
}
echo $filecontent . "</ul></div>";

// exit;
// exit;
} else {
// 解析异常
$ErrorCode = $Filejson["errtype"];
Expand Down
6 changes: 6 additions & 0 deletions install/config_raw
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ if (!defined('init')) {
http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./');
die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的配置文件!\r\n禁止直接访问!");
}
if (!function_exists('curl_init')) {
http_response_code(503);
header('Content-Type: text/plain; charset=utf-8');
die("HTTP 503 服务不可用!\r\n您未安装或未启用 Curl 扩展,此程序无法运行!");
}

const Sitename = '<Sitename>';

const BDUSS = '<BDUSS>';
Expand Down

0 comments on commit 3f210df

Please sign in to comment.