From 4eaae6ac4e0c9248f765240226ffe484716b00fb Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 20 Jun 2023 16:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AB=99=E5=86=85=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E9=93=BE=E6=8E=A5=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化后台链接跳转 --- application/admin/controller/Index.php | 3 ++- application/common.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index b988cb29..ed770eeb 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -66,7 +66,8 @@ class Index extends Backend */ public function login() { - $url = $this->request->get('url', 'index/index', 'url_clean'); + $url = $this->request->get('url', '', 'url_clean'); + $url = $url ?: 'index/index'; if ($this->auth->isLogin()) { $this->success(__("You've logged in, do not login again"), $url); } diff --git a/application/common.php b/application/common.php index 3465f844..6123f316 100755 --- a/application/common.php +++ b/application/common.php @@ -514,7 +514,7 @@ if (!function_exists('check_url_allowed')) { } //如果是站内相对链接则允许 - if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+\$/i", $url) && substr($url, 0, 2) !== '//') { + if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+((\?|#).*)?\$/i", $url) && substr($url, 0, 2) !== '//') { return true; }