mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added null check for $id
This commit is contained in:
@@ -920,14 +920,21 @@ function validate_device_id($id)
|
||||
{
|
||||
|
||||
global $config;
|
||||
$device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `device_id` = ?", array($id));
|
||||
if($device_id == $id)
|
||||
if(empty($id) || !is_numeric($id))
|
||||
{
|
||||
$return = true;
|
||||
$return = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = false;
|
||||
$device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `device_id` = ?", array($id));
|
||||
if($device_id == $id)
|
||||
{
|
||||
$return = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
return($return);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user