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

Commit

Permalink
fix(sec): Change query method
Browse files Browse the repository at this point in the history
* Use prepare statement on queries
  • Loading branch information
leoncx authored and sc979 committed Jun 4, 2018
1 parent e676695 commit f9e5737
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@
}

if ($accessHost) {
$DBRESULT = $pearDBO->query(
"SELECT * FROM `log_archive_host` WHERE host_id = '"
. $pearDBO->escape($_GET["id"])
. "' order by date_start desc"
);
$query = 'SELECT * FROM `log_archive_host` WHERE host_id = ? ORDER BY date_start DESC';
$stmt = $pearDBO->prepare($query);
$DBRESULT = $pearDBO->execute($stmt, array($_GET['id']));
while ($row = $DBRESULT->fetchRow()) {
fillBuffer($statesTab, $row, $color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@
}

if ($accessService) {
$DBRESULT = $pearDBO->query(
"SELECT * FROM `log_archive_service` WHERE host_id = '".
$pearDBO->escape($_GET["host_id"])."' AND service_id = '".
$pearDBO->escape($_GET["id"])."' ORDER BY `date_start` DESC"
);
$query = 'SELECT * FROM `log_archive_service` WHERE host_id = ? AND service_id = ? ORDER BY date_start DESC';
$stmt = $pearDBO->prepare($query);
$DBRESULT = $pearDBO->execute($stmt, array($_GET['host_id'], $_GET['id']));
while ($row = $DBRESULT->fetchRow()) {
fillBuffer($statesTab, $row, $color);
}
Expand Down

0 comments on commit f9e5737

Please sign in to comment.