diff --git a/README.md b/README.md index b6bbf031..0c9ee16f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ ### 🛠 安装要求 * PHP 版本 ≥ 5.6(≤ 7.3) * mysql 版本 ≥ 5.5 -* mysqli 支持 +* PDO 拓展 * ZipArchive 支持 * fileinfo 拓展 * curl 拓展 diff --git a/application/http/middleware/Initialize.php b/application/http/middleware/Initialize.php index 94913026..de45a949 100644 --- a/application/http/middleware/Initialize.php +++ b/application/http/middleware/Initialize.php @@ -18,14 +18,14 @@ class Initialize if ($request->controller(true) !== 'install' || $request->action(true) !== 'index') { return redirect(url('install/index')); } - } - - // 检测封禁IP - $banIp = $this->getConfig('ban_ip'); - if ($banIp) { - $ips = explode(',', str_replace(',', ',', $banIp)); - if (in_array($request->ip(), $ips)) { - throw new HttpResponseException(Response::code(403)); + } else { + // 检测封禁IP + $banIp = $this->getConfig('ban_ip'); + if ($banIp) { + $ips = explode(',', str_replace(',', ',', $banIp)); + if (in_array($request->ip(), $ips)) { + throw new HttpResponseException(Response::code(403)); + } } } diff --git a/application/http/middleware/WebAuthenticate.php b/application/http/middleware/WebAuthenticate.php index 4fa67ae8..f029dfd0 100644 --- a/application/http/middleware/WebAuthenticate.php +++ b/application/http/middleware/WebAuthenticate.php @@ -31,7 +31,9 @@ class WebAuthenticate $user = null; if ($uid = Session::get('uid')) { - $user = Users::get($uid); + if (!$user = Users::get($uid)) { + Session::delete('uid'); + } } if (!in_array($path, $this->paths) && !$user) { diff --git a/application/index/controller/Install.php b/application/index/controller/Install.php index a1fd0f0b..7cf956a3 100644 --- a/application/index/controller/Install.php +++ b/application/index/controller/Install.php @@ -25,18 +25,18 @@ class Install extends Controller $phpVerGt56 = PHP_VERSION >= 5.6; $isCurl = function_exists('curl_init'); $isFileInfo = function_exists('finfo_open'); - $isMysqli = class_exists('mysqli'); + $pdo = extension_loaded("pdo_mysql"); $isZip = class_exists('ZipArchive'); switch ($step) { case 1: // 运行环境检测 - $testing = $phpVerGt56 && $isCurl && $isFileInfo && $isMysqli && $isZip; + $testing = $phpVerGt56 && $isCurl && $isFileInfo && $pdo && $isZip; $this->assign([ 'phpVerGt56' => $phpVerGt56, 'isCurl' => $isCurl, 'isFileInfo' => $isFileInfo, - 'isMysqli' => $isMysqli, + 'pdo' => $pdo, 'isZip' => $isZip, 'testing' => $testing, 'dir' => is_writable(app()->getRuntimePath()) && is_writable(app()->getConfigPath()), diff --git a/application/index/view/install/index.html b/application/index/view/install/index.html index 776186f6..f10a0943 100644 --- a/application/index/view/install/index.html +++ b/application/index/view/install/index.html @@ -76,10 +76,10 @@