fixes from mrobbert

git-svn-id: http://www.observium.org/svn/observer/trunk@2429 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-08 05:02:14 +00:00
parent 3b2446d3cb
commit e8d37edaf9
3 changed files with 7 additions and 11 deletions

View File

@@ -372,7 +372,7 @@ function humanspeed($speed)
function print_error($text)
{
echo('<div class="errorbox"><img src="/images/15/exclamation.png" align="absmiddle"> '.$text.'</div>');
echo('<div class="errorbox"><img src="/images/16/exclamation.png" align="absmiddle"> '.$text.'</div>');
}
function print_message($text)

View File

@@ -8,12 +8,12 @@ if ($_SESSION['userlevel'] < 10)
echo("<h2>Add Device</h2>");
if ($_POST['hostname'] && $_POST['community'])
if ($_POST['hostname'])
{
if ($_SESSION['userlevel'] > '5')
{
$hostname = mres($_POST['hostname']);
$community = mres($_POST['community']);
if ($_POST['community']) { $community = mres($_POST['community']); } else { $community = $config['snmp']['community']; }
$snmpver = mres($_POST['snmpver']);
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
print_message("Adding host $hostname community $community port $port");
@@ -21,10 +21,6 @@ if ($_POST['hostname'] && $_POST['community'])
} else {
print_error("You don't have the necessary privileges to add hosts.");
}
} elseif ($_POST['hostname'] && !$_POST['community']) {
print_error("A community string is required.");
} elseif (!$_POST['hostname'] && $_POST['community']) {
print_error("A hostname is required.");
}
?>

View File

@@ -190,10 +190,10 @@ function addHost($host, $community, $snmpver, $port = 161, $transport = 'udp')
if ($snmphost == $host || $hostshort = $host)
{
createHost($host, $community, $snmpver, $port, $transport);
} else { echo("Given hostname does not match SNMP-read hostname!\n"); }
} else { echo("Already got host $host\n"); }
} else { echo("Could not ping $host\n"); }
} else { echo("Could not resolve $host\n"); }
} else { print_error("Given hostname does not match SNMP-read hostname!\n"); }
} else { print_error("Already got host $host\n"); }
} else { print_error("Could not ping $host\n"); }
} else { print_error("Could not resolve $host\n"); }
}
function scanUDP($host, $port, $timeout)