mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Search device by MAC via URL (#14072)
* Search MAC by GET * Add address from parsed vars * Trim tabs and spaces when searching MAC
This commit is contained in:
@@ -77,7 +77,7 @@ if ($_POST['interface'] == 'Vlan%') {
|
||||
"<div class=\"form-group\">"+
|
||||
"<input type=\"text\" name=\"address\" id=\"address\" value=\""+
|
||||
<?php
|
||||
echo '"' . htmlspecialchars($_POST['address']) . '"+';
|
||||
echo '"' . htmlspecialchars($vars['address']) . '"+';
|
||||
?>
|
||||
|
||||
"\" class=\"form-control input-sm\" placeholder=\"Mac Address\"/>"+
|
||||
@@ -93,7 +93,7 @@ echo '"' . htmlspecialchars($_POST['address']) . '"+';
|
||||
search_type: "mac",
|
||||
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
|
||||
interface: '<?php echo htmlspecialchars($_POST['interface']); ?>',
|
||||
address: '<?php echo htmlspecialchars($_POST['address']); ?>'
|
||||
address: '<?php echo htmlspecialchars($vars['address']); ?>'
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php",
|
||||
|
@@ -37,7 +37,7 @@ if ($vars['search_type'] == 'ipv4') {
|
||||
}
|
||||
} elseif ($vars['search_type'] == 'mac') {
|
||||
$sql = ' FROM `ports` AS I, `devices` AS D';
|
||||
$sql .= " WHERE I.device_id = D.device_id AND `ifPhysAddress` LIKE '%" . str_replace([':', ' ', '-', '.', '0x'], '', $vars['address']) . "%' $where ";
|
||||
$sql .= " WHERE I.device_id = D.device_id AND `ifPhysAddress` LIKE '%" . trim(str_replace([':', ' ', '-', '.', '0x'], '', $vars['address'])) . "%' $where ";
|
||||
}//end if
|
||||
if (is_numeric($vars['device_id'])) {
|
||||
$sql .= ' AND I.device_id = ?';
|
||||
|
Reference in New Issue
Block a user