Managementinterface retrieves data from database;
Table on interface is editable; replaced library.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
include_once('../include/lucidAuth.functions.php');
|
||||
|
||||
|
||||
if (!empty($_COOKIE['JWT'])) {
|
||||
$validateTokenResult = validateToken($_COOKIE['JWT']);
|
||||
}
|
||||
@ -10,9 +10,32 @@
|
||||
if ($validateTokenResult['status'] === "Success") {
|
||||
include_once('../include/lucidAuth.template.php');
|
||||
|
||||
echo sprintf($pageLayout['full'],
|
||||
try {
|
||||
$allUsers = $pdoDB->query('
|
||||
SELECT User.Username, Role.Rolename, COUNT(DISTINCT SecureToken.Value) AS Sessions
|
||||
FROM User
|
||||
LEFT JOIN Role
|
||||
ON (User.RoleId=Role.Id)
|
||||
LEFT JOIN SecureToken
|
||||
ON (User.Id=SecureToken.UserId)
|
||||
')->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (Exception $e) {
|
||||
// Should really do some actual errorhandling here
|
||||
throw new Exception($e);
|
||||
}
|
||||
|
||||
foreach($allUsers as $row) {
|
||||
$tableRows[] = sprintf('<tr><td>%1$s</td><td>%2$s</td><td class="immutable"><a href="?">%3$s</a></td></tr>',
|
||||
explode('\\', $row['Username'])[1],
|
||||
$row['Rolename'],
|
||||
$row['Sessions']
|
||||
);
|
||||
}
|
||||
|
||||
echo sprintf($pageLayout['full'],
|
||||
sprintf($contentLayout['manage'],
|
||||
$validateTokenResult['name']
|
||||
$validateTokenResult['name'],
|
||||
implode($tableRows)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user