From 6ce5695197ca6b3137a44d775baff00aaa6e0673 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 5 Oct 2017 00:58:16 +0200 Subject: [PATCH] consistently use empty() to check user existence Succinct without causing PHP notices even for array access. --- edit.php | 2 +- login.php | 14 +++++++------- page.inc.php | 8 ++++---- page.php | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/edit.php b/edit.php index 9ba0d04..4e51097 100644 --- a/edit.php +++ b/edit.php @@ -7,7 +7,7 @@ function abort($body, $status = NULL) { exit; } -if (!@$User['admin']) +if (empty($User['admin'])) abort("geen beheersrechten", '401 unauthorised'); if ($_FILES) { diff --git a/login.php b/login.php index 3b59064..9c5f06e 100644 --- a/login.php +++ b/login.php @@ -15,19 +15,19 @@ elseif (isset($_GET['logout'])) { $message = 'Uitgelogd.'; } -if (isset($_GET['goto']) and isset($User)) { +if (empty($User)) { + ob_clean(); + require_once 'login.inc.php'; + return TRUE; +} + +if (isset($_GET['goto'])) { ob_clean(); $target = ltrim($_GET['goto'], '/'); header("Location: /$target"); http_response_code(302); exit; } - -if (empty($User)) { - ob_clean(); - require_once 'login.inc.php'; - return TRUE; -} ?>

Ingelogd als .

diff --git a/page.inc.php b/page.inc.php index 393d614..54a3944 100644 --- a/page.inc.php +++ b/page.inc.php @@ -7,10 +7,10 @@ print "
\n"; ob_start(); include DOCROOT.'menu.html'; ob_start(); -if (isset($User)) { +if (!empty($User)) { print '