Escape column names for mysql 8. Fixes #3092

This commit is contained in:
Isaac Connor 2020-12-05 16:38:53 -05:00
parent fdbca4760f
commit ea6478b8a0
1 changed files with 5 additions and 5 deletions

View File

@ -80,10 +80,10 @@ if ( $groupSql )
foreach ( array('ServerId','StorageId','Status','Function') as $filter ) { foreach ( array('ServerId','StorageId','Status','Function') as $filter ) {
if ( isset($_SESSION[$filter]) ) { if ( isset($_SESSION[$filter]) ) {
if ( is_array($_SESSION[$filter]) ) { if ( is_array($_SESSION[$filter]) ) {
$conditions[] = $filter . ' IN ('.implode(',', array_map(function(){return '?';}, $_SESSION[$filter])). ')'; $conditions[] = '`'.$filter . '` IN ('.implode(',', array_map(function(){return '?';}, $_SESSION[$filter])). ')';
$values = array_merge($values, $_SESSION[$filter]); $values = array_merge($values, $_SESSION[$filter]);
} else { } else {
$conditions[] = $filter . '=?'; $conditions[] = '`'.$filter . '`=?';
$values[] = $_SESSION[$filter]; $values[] = $_SESSION[$filter];
} }
} }
@ -249,9 +249,9 @@ $html .= '</span>
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All', 'data-placeholder'=>'All',
) ); ) );
# Repurpose this variable to be the list of MonitorIds as a result of all the filtering # Repurpose this variable to be the list of MonitorIds as a result of all the filtering
$selected_monitor_ids = array_map(function($monitor_row){return $monitor_row['Id'];}, $displayMonitors); $selected_monitor_ids = array_map(function($monitor_row){return $monitor_row['Id'];}, $displayMonitors);
$html .= '</span> $html .= '</span>
'; ';
echo $html; echo $html;
?> ?>