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

Commit

Permalink
MON-14501 - sanitize query in centreonXmlbgRequest class (#11571)
Browse files Browse the repository at this point in the history
* sanitize query in centreonXmlbgRequest class

* add closeCursor func to resolve conv
  • Loading branch information
emabassi-ext authored Aug 11, 2022
1 parent 6390687 commit c08f72c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions www/class/centreonXMLBGRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ public function __construct(

private function isUserAdmin()
{
$query = "SELECT contact_admin, contact_id FROM contact " .
"WHERE contact.contact_id = '" . CentreonDB::escape($this->user_id) . "' LIMIT 1";
$dbResult = $this->DB->query($query);
$admin = $dbResult->fetchRow();
$dbResult->closeCursor();
$statement = $this->DB->prepare("SELECT contact_admin, contact_id FROM contact " .
"WHERE contact.contact_id = :userId LIMIT 1");
$statement->bindValue(":userId", (int) $this->user_id, \PDO::PARAM_INT);
$statement->execute();
$admin = $statement->fetchRow();
$statement->closeCursor();
if ($admin !== false && $admin["contact_admin"]) {
$this->is_admin = 1;
} else {
Expand Down

0 comments on commit c08f72c

Please sign in to comment.