prepare(' SELECT SecureToken.Id, SecureToken.UserId, SecureToken.Value FROM SecureToken WHERE SecureToken.UserId = :userid '); $pdoQuery->execute([ ':userid' => (int) $_REQUEST['userid'] ]); foreach($pdoQuery->fetchAll(PDO::FETCH_ASSOC) as $row) { try { $JWTPayload = JWT::decode($row['Value'], base64_decode($settings->JWT['PrivateKey_base64']), $settings->JWT['Algorithm']); $storedTokens[] = [ 'tid' => $row['Id'], 'iat' => $JWTPayload->iat, 'iss' => $JWTPayload->iss, 'fp' => $JWTPayload->fp ]; } catch (Exception $e) { // Invalid token continue; } } // Return JSON object header('Content-Type: application/json'); echo json_encode([ "Result" => "Success", "SessionCount" => sizeof($storedTokens), "UserSessions" => json_encode($storedTokens) ]); break; case 'deletesession': if (isset($_REQUEST['userid']) && isset($_REQUEST['tokenid'])) { try { $pdoQuery = $pdoDB->prepare(' DELETE FROM SecureToken WHERE SecureToken.UserId = :userid AND SecureToken.Id = :tokenid '); $pdoQuery->execute([ ':userid' => (int) $_REQUEST['userid'], ':tokenid' => (int) $_REQUEST['tokenid'] ]); // Return JSON object header('Content-Type: application/json'); echo json_encode([ "Result" => "Success", "RowCount" => $pdoQuery->RowCount() ]); } catch (Exception $e) { // Return JSON object header('Content-Type: application/json'); echo json_encode([ "Result" => "Failure", "Reason" => "Failed deleting tokens from database" ]); exit; } } else { header('Content-Type: application/json'); echo json_encode([ "Result" => "Failure", "Reason" => "Incomplete request data" ]); } break; default: // No action requested, default action include_once('../include/lucidAuth.template.php'); try { $allUsers = $pdoDB->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('