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

MON-14501 - sanitize query in centreonXmlbgRequest class #11571

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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