Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
sanitize and bind host categories queryà (#11591)
Browse files Browse the repository at this point in the history
  • Loading branch information
emabassi-ext authored Aug 17, 2022
1 parent e74ae7d commit 0c7d577
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,11 @@ function multipleHostCategoriesInDB($hostCategories = [], $nbrDup = [])
$statement3->bindValue(':hc_id', $hcId, \PDO::PARAM_INT);
$statement3->execute();
$fields["hc_hosts"] = "";
$hrstatement = $pearDB->prepare("INSERT INTO hostcategories_relation VALUES (:maxId, :hostId)");
while ($host = $statement3->fetch()) {
$query = "INSERT INTO hostcategories_relation VALUES ('" . $maxId["MAX(hc_id)"] .
"', '" . $host["host_host_id"] . "')";
$pearDB->query($query);
$hrstatement->bindValue(':maxId', (int) $maxId["MAX(hc_id)"], \PDO::PARAM_INT);
$hrstatement->bindValue(':hostId', (int) $host["host_host_id"], \PDO::PARAM_INT);
$hrstatement->execute();
$fields["hc_hosts"] .= $host["host_host_id"] . ",";
}
$fields["hc_hosts"] = trim($fields["hc_hosts"], ",");
Expand Down

0 comments on commit 0c7d577

Please sign in to comment.