From 9734a2022703ad67409da0acf05cbe177a06419a Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 3 Apr 2016 08:09:59 +0800 Subject: [PATCH] added HTTP redirect function --- 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 ++-- libraries/Utils.class.php | 20 ++++++++++++++++++-- libraries/session.inc.php | 6 +++--- setup/install.php | 12 ++++++------ 10 files changed, 41 insertions(+), 25 deletions(-) diff --git a/admin/adduser.php b/admin/adduser.php index 5efcac71..1e8b3c74 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-02 18:33:01 + * @Last Modified time: 2016-04-03 07:55:53 */ require "../libraries/session.inc.php"; -if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); 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 164e06cd..359a584b 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-03-27 11:29:16 + * @Last Modified time: 2016-04-03 07:55:53 */ require "../libraries/session.inc.php"; // Check token, won't allow non-admin user to access -if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); /* * No protection here, diff --git a/admin/customize.php b/admin/customize.php index 183a3c72..5729bd93 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-02 18:33:01 + * @Last Modified time: 2016-04-03 07:55:53 */ require "../libraries/session.inc.php"; -if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); +if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员'); $data['style'] = <<< 'EOT'