mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Allow full search on devices page (#8364)
* Update devices.inc.php * Update devices.inc.php * Replace $_POST with $vars Better protection for SQL injection attempts; Need to verify other files for same issue. * Fixed whitespace. *sigh* * More search options & sql injection fixes. +Allow full search on devices page; +Allow sysName search on alertlog page; +Allow sysName search on alerts page; +Allow sysName search on eventlog page; +Allow sysName search on poll-log page; +Allow sysName search on ports page; *Replaced all occurrences of $_POST with $vars in librenms/html/includes/table. ($vars are sanity-checked). * Whitespace fix * Fixed $where & $param * Add files via upload * Whitespaces.... Sometimes you want'em, sometimes you hate'em.
This commit is contained in:
committed by
Neil Lathwood
parent
2044f9bd14
commit
9f5b42b028
@@ -12,24 +12,24 @@ if (is_admin() === false && is_read() === false) {
|
||||
|
||||
$sql .= " WHERE M.port_id = P.port_id AND P.device_id = D.device_id $where ";
|
||||
|
||||
if (is_numeric($_POST['device_id'])) {
|
||||
if (is_numeric($vars['device_id'])) {
|
||||
$sql .= ' AND P.device_id = ?';
|
||||
$param[] = $_POST['device_id'];
|
||||
$param[] = $vars['device_id'];
|
||||
}
|
||||
|
||||
if (is_numeric($_POST['port_id'])) {
|
||||
if (is_numeric($vars['port_id'])) {
|
||||
$sql .= ' AND P.port_id = ?';
|
||||
$param[] = $_POST['port_id'];
|
||||
$param[] = $vars['port_id'];
|
||||
}
|
||||
|
||||
if (isset($_POST['searchPhrase']) && !empty($_POST['searchPhrase'])) {
|
||||
$ip_search = '%'.mres(trim($_POST['searchPhrase'])).'%';
|
||||
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['searchPhrase'])).'%';
|
||||
if (isset($vars['searchPhrase']) && !empty($vars['searchPhrase'])) {
|
||||
$ip_search = '%'.mres(trim($vars['searchPhrase'])).'%';
|
||||
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($vars['searchPhrase'])).'%';
|
||||
|
||||
if (isset($_POST['searchby']) && $_POST['searchby'] == 'ip') {
|
||||
if (isset($vars['searchby']) && $vars['searchby'] == 'ip') {
|
||||
$sql .= ' AND `ipv4_address` LIKE ?';
|
||||
$param[] = $ip_search;
|
||||
} elseif (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
||||
} elseif (isset($vars['searchby']) && $vars['searchby'] == 'mac') {
|
||||
$sql .= ' AND `mac_address` LIKE ?';
|
||||
$param[] = $mac_search;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user