fix resolving fuckup

git-svn-id: http://www.observium.org/svn/observer/trunk@1869 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-03-16 12:12:10 +00:00
parent 1b35158517
commit b6ca1fe6c6
3 changed files with 99 additions and 6 deletions

View File

@@ -1,17 +1,102 @@
<?php
echo('<div style="padding: 10px;">');
if($_POST['addapp']) {
if($_SESSION['userlevel'] == '10') {
include("includes/app-add.inc.php");
}
}
if($_POST['delapp']) {
if($_SESSION['userlevel'] == '10') {
include("includes/app-delete.inc.php");
}
}
if ($handle = opendir($config['install_dir'] . "/includes/polling/applications/")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && strstr($file, ".inc.php")) {
$file = str_replace(".inc.php", "", $file);
$servicesform .= "<option value='$file'>$file</option>";
$file = str_replace(".inc.php", "", $file);
$applicationsform .= "<option value='$file'>$file</option>";
}
}
closedir($handle);
}
echo("$servicesform");
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while($device = mysql_fetch_array($query)) {
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
}
if($updated) { print_message("Applications Updated"); }
if(mysql_result(mysql_query("SELECT COUNT(*) from `applications` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') {
$i = "1";
$app_query = mysql_query("select * from applications WHERE device_id = '".$device['device_id']."' ORDER BY app_type");
while($application = mysql_fetch_array($app_query)) {
$existform .= "<option value='" . $application['app_id'] . "'>" . $application['app_type'] . "</option>";
}
}
if($existform){
echo('<div style="float: left;">');
echo("
<h1>Remove application</h1>
<form id='delapp' name='delapp' method='post' action=''>
<input type=hidden name='delapp' value='yes'>
<table width='200' border='0'>
<option type=hidden name=device value='".$device['device_id']."'>
<tr>
<td>
Type
</td>
<td>
<select name='app'>
$existform
</select>
</td>
</tr>
</table>
<input type='submit' name='Submit' value='Delete' />
<label><br />
</label>
</form>");
echo('</div>');
}
echo('<div style="width: 45%; float: right;">');
echo("
<h1>Add application</h1>
<form id='addapp' name='addapp' method='post' action=''>
<input type=hidden name='addapp' value='yes'>
<table width='200' border='0'>
<option type=hidden name=device value='".$device['device_id']."'>
<tr>
<td>
Type
</td>
<td>
<select name='type'>
$applicationsform
</select>
</td>
</tr>
</table>
<input type='submit' name='Submit' value='Add' />
<label><br />
</label>
</form>");
echo('</div>');
echo('</div>');
?>

View File

@@ -32,8 +32,6 @@ while($device = mysql_fetch_array($query)) {
if($updated) { print_message("Device Settings Saved"); }
echo('<div style="float: left;">');
if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') {
$i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
@@ -44,7 +42,12 @@ if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` =
}
if($existform){
echo('<div style="float: left;">');
echo("
<h1>Remove Service</h1>
<form id='delsrv' name='delsrv' method='post' action=''>
<input type=hidden name='delsrv' value='yes'>
<table width='200' border='0'>
@@ -67,10 +70,13 @@ echo("
echo('</div>');
}
echo('<div style="width: 45%; float: right;">');
echo("
<h1>Add Service</h1>
<form id='addsrv' name='addsrv' method='post' action=''>
<input type=hidden name='addsrv' value='yes'>
<table width='200' border='0'>

View File

@@ -527,7 +527,9 @@ function createHost ($host, $community, $snmpver, $port = 161, $transport = 'udp
function isDomainResolves($domain)
{
return count(dns_get_record($domain)) != 0;
# duh.
#return count(dns_get_record($domain)) != 0;
return gethostbyname($domain) != $domain;
}
function hoststatus($id)