"7")
{
$community = mres($_POST['community']);
$snmpver = mres($_POST['snmpver']);
$port = mres($_POST['port']);
$timeout = mres($_POST['timeout']);
$retries = mres($_POST['retries']);
$v3 = array (
'authlevel' => mres($_POST['authlevel']),
'authname' => mres($_POST['authname']),
'authpass' => mres($_POST['authpass']),
'authalgo' => mres($_POST['authalgo']),
'cryptopass' => mres($_POST['cryptopass']),
'cryptoalgo' => mres($_POST['cryptoalgo'])
);
#FIXME needs better feedback
$update = array(
'community' => $community,
'snmpver' => $snmpver,
'port' => $port
);
if ($_POST['timeout']) { $update['timeout'] = $timeout; }
else { $update['timeout'] = array('NULL'); }
if ($_POST['retries']) { $update['retries'] = $retries; }
else { $update['retries'] = array('NULL'); }
$update = array_merge($update, $v3);
$rows_updated = dbUpdate($update, 'devices', '`device_id` = ?',array($device['device_id']));
if ($rows_updated > 0)
{
$update_message = $rows_updated . " Device record updated.";
$updated = 1;
} elseif ($rows_updated = '-1') {
$update_message = "Device record unchanged. No update necessary.";
$updated = -1;
} else {
$update_message = "Device record update error.";
$updated = 0;
}
}
}
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id']));
$descr = $device['purpose'];
if ($updated && $update_message)
{
print_message($update_message);
} elseif ($update_message) {
print_error($update_message);
}
echo("