Private GIT

Skip to content
Snippets Groups Projects
Commit d5204752 authored by Maximilien Bersoult's avatar Maximilien Bersoult Committed by Stephane Chapron
Browse files

fix(sec): Change query method

* Use prepare statement on queries
parent 018ca65a
No related tags found
No related merge requests found
...@@ -69,11 +69,9 @@ if (isset($_GET["id"]) && isset($_GET["color"])) { ...@@ -69,11 +69,9 @@ if (isset($_GET["id"]) && isset($_GET["color"])) {
} }
if ($accessHost) { if ($accessHost) {
$DBRESULT = $pearDBO->query( $query = 'SELECT * FROM `log_archive_host` WHERE host_id = ? ORDER BY date_start DESC';
"SELECT * FROM `log_archive_host` WHERE host_id = '" $stmt = $pearDBO->prepare($query);
. $pearDBO->escape($_GET["id"]) $DBRESULT = $pearDBO->execute($stmt, array($_GET['id']));
. "' order by date_start desc"
);
while ($row = $DBRESULT->fetchRow()) { while ($row = $DBRESULT->fetchRow()) {
fillBuffer($statesTab, $row, $color); fillBuffer($statesTab, $row, $color);
} }
......
...@@ -68,11 +68,9 @@ if (isset($_GET["host_id"]) && isset($_GET["id"]) && isset($_GET["color"])) { ...@@ -68,11 +68,9 @@ if (isset($_GET["host_id"]) && isset($_GET["id"]) && isset($_GET["color"])) {
} }
if ($accessService) { if ($accessService) {
$DBRESULT = $pearDBO->query( $query = 'SELECT * FROM `log_archive_service` WHERE host_id = ? AND service_id = ? ORDER BY date_start DESC';
"SELECT * FROM `log_archive_service` WHERE host_id = '". $stmt = $pearDBO->prepare($query);
$pearDBO->escape($_GET["host_id"])."' AND service_id = '". $DBRESULT = $pearDBO->execute($stmt, array($_GET['host_id'], $_GET['id']));
$pearDBO->escape($_GET["id"])."' ORDER BY `date_start` DESC"
);
while ($row = $DBRESULT->fetchRow()) { while ($row = $DBRESULT->fetchRow()) {
fillBuffer($statesTab, $row, $color); fillBuffer($statesTab, $row, $color);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment