From faa99d43ebe1e48fb2a1e866313a1082e2798199 Mon Sep 17 00:00:00 2001 From: printempw Date: Thu, 12 May 2016 22:01:38 +0800 Subject: [PATCH] rewrited implementation of showing msg to prevent XSS attack, close #14 --- admin/adduser.php | 4 ++-- admin/admin_ajax.php | 4 ++-- admin/customize.php | 4 ++-- admin/index.php | 4 ++-- admin/manage.php | 4 ++-- admin/options.php | 4 ++-- admin/update.php | 4 ++-- index.php | 10 ++++++---- libraries/Utils.class.php | 6 ++++-- libraries/session.inc.php | 6 +++--- setup/install.php | 4 ++-- templates/admin/download.tpl.php | 2 +- 12 files changed, 30 insertions(+), 26 deletions(-) diff --git a/admin/adduser.php b/admin/adduser.php index 33e31f58..b32f72a5 100644 --- a/admin/adduser.php +++ b/admin/adduser.php @@ -3,10 +3,10 @@ * @Author: printempw * @Date: 2016-03-19 21:00:58 * @Last Modified by: printempw - * @Last Modified time: 2016-04-03 20:58:33 + * @Last Modified time: 2016-05-12 21:53:48 */ require "../libraries/session.inc.php"; -if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php', '看起来你并不是管理员'); View::show('admin/header', array('page_title' => "添加用户")); $db = new Database\Database('users'); ?> diff --git a/admin/admin_ajax.php b/admin/admin_ajax.php index 5956c72e..cb512e12 100644 --- a/admin/admin_ajax.php +++ b/admin/admin_ajax.php @@ -3,12 +3,12 @@ * @Author: printempw * @Date: 2016-02-04 13:53:55 * @Last Modified by: printempw - * @Last Modified time: 2016-04-03 08:26:15 + * @Last Modified time: 2016-05-12 21:53:48 */ require "../libraries/session.inc.php"; // Check token, won't allow non-admin user to access -if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php', '看起来你并不是管理员'); /* * No protection here, diff --git a/admin/customize.php b/admin/customize.php index 597169a5..c4ec1a9c 100644 --- a/admin/customize.php +++ b/admin/customize.php @@ -3,10 +3,10 @@ * @Author: printempw * @Date: 2016-03-19 14:34:21 * @Last Modified by: printempw - * @Last Modified time: 2016-04-03 20:58:26 + * @Last Modified time: 2016-05-12 21:53:48 */ require "../libraries/session.inc.php"; -if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php', '看起来你并不是管理员'); $data['style'] = <<< 'EOT'