Refactored, no more redirects. Improved error messaging system
This commit is contained in:
11
user.php
11
user.php
@@ -10,7 +10,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
include("includes.php");
|
||||
|
||||
if (($_SESSION['suser_role_admin'] == 0) and ($_SESSION['suser_role_manage'] == 0)) {
|
||||
header_location('comments.php?comments=accessdenied');
|
||||
$g_error->add('Access denied!');
|
||||
$action = ACT_ERR_DENIED;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
@@ -170,6 +171,14 @@ $smarty->assign("user", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("userdel.tpl");
|
||||
|
||||
elseif ($action == ACT_ERR_DENIED):
|
||||
// ========== ERROR ACCESS TO PAGE DENIED =====================================
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
echo '<p"><a href="', $_SERVER['HTTP_REFERER'], '">', "Back to last page</a></p>\n";
|
||||
}
|
||||
echo "<p></p>";
|
||||
|
||||
else:
|
||||
// ========== ERROR UNKNOWN VARIANT ===========================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user