Skip to content

Commit

Permalink
Bind group_id param to query
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Oct 25, 2021
1 parent c9539f4 commit 7fc3d4e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/Core/includes/endpoints/ListUsersEndpoint.php
Expand Up @@ -14,6 +14,8 @@ public function __construct() {
}

public function execute(Nameless2API $api) {
$params = [];

$discord_enabled = Util::isModuleEnabled('Discord Integration');

if ($discord_enabled) {
Expand All @@ -27,7 +29,8 @@ public function execute(Nameless2API $api) {
: ' AND';

if (isset($_GET['group_id'])) {
$query .= ' INNER JOIN nl2_users_groups ug ON u.id = ug.user_id WHERE ug.group_id = ' . $_GET['group_id'];
$query .= ' INNER JOIN nl2_users_groups ug ON u.id = ug.user_id WHERE ug.group_id = ?';
$params[] = $_GET['group_id'];
$filterGroup = true;
}

Expand Down Expand Up @@ -60,7 +63,7 @@ public function execute(Nameless2API $api) {
$query .= ' `u.discord_id` IS ' . ($_GET['discord_linked'] == 'true' ? 'NOT' : '') . ' NULL';
}

$users = $api->getDb()->query($query)->results();
$users = $api->getDb()->query($query, $params)->results();

$users_json = array();
foreach ($users as $user) {
Expand Down

0 comments on commit 7fc3d4e

Please sign in to comment.