query(' SELECT User.Id, User.Username, Role.Rolename FROM User LEFT JOIN Role ON (Role.Id = User.RoleId) ')->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { // Should really do some actual errorhandling here throw new Exception($e); } foreach($allUsers as $row) { $tableRows[] = sprintf('%3$s%4$s%5$s', $validateTokenResult['uid'] === $row['Id'] ? 'class="currentuser"': null, $row['Id'], explode('\\', $row['Username'])[1], $row['Rolename'], '' . ($validateTokenResult['uid'] === $row['Id'] ? null : ' ') ); } echo sprintf($pageLayout['full_alt'], sprintf($contentLayout['manage']['header'], $validateTokenResult['name'] ), sprintf($contentLayout['manage']['section'], implode($tableRows) ) ); } else { // No cookie containing valid authentication token found; // explicitly deleting any remaining cookie, then redirecting to loginpage setcookie('JWT', FALSE); header("HTTP/1.1 401 Unauthorized"); header("Location: lucidAuth.login.php"); } ?>