Location: PHPKode > scripts > eNetman > enetman-20050830/enetman/html/modules/nagios/top.php
<?

error_reporting(0);
foreach ($_POST as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_GET as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_SERVER as $varname => $varvalue) {
        $$varname = $varvalue;
}
if($debug) {
        error_reporting(1);
        error_reporting(E_ALL);
}

include "functions.php";

$page = $_GET['page'];

$display = 1;

$hquery = "SELECT * FROM nHosts";
$hresults  = mysql_query($hquery);
$hrows = mysql_num_rows($hresults);

$gquery = "SELECT * FROM nHostgroups";
$gresults  = mysql_query($gquery);
$grows = mysql_num_rows($gresults);

$squery = "SELECT * FROM nServices";
$sresults  = mysql_query($squery);
$srows = mysql_num_rows($sresults);

if((!$hrows) || (!$grows) || (!$srows)) {
	$display = 0;
}

if((!$grows) && (!$hrows)) {
	$disable = "disabled";
}

echo "<center><b><h2>Nagios</b></center><br>";

echo "<table bgcolor='000000' cellpadding=0 border=0 cellspacing=0 align='center' width='80%'>\n";
echo "\t<tr>\n";
echo "\t\t<td>\n";

if($display) {
	echo "<table cellpadding=0 border=0 cellspacing=1 width='100%'>";
	echo "<tr>";
	echo "<td bgcolor='#FFFFFF' align='center'>";
	echo "<a href='$modulepath/report.php' target='_blank'>Run report</a>";
	echo "</td>";
	echo "</tr>";
	echo "</table>";
}

echo "\t\t\t<table cellpadding=0 border=0 cellspacing=1 width='100%'>\n";
echo "\t\t\t\t<tr>\n";
echo "<td bgcolor='#D3DCE3' align='center'><b>Import Files</b></td>";
echo "</tr>";
echo "\t\t\t\t<tr>\n";
echo "<td bgcolor='#FFFFFF' align='center'>";
if(!$display) {
	echo "<font color='red'>Database not fully populated</font>";
}
echo "<table width='100%' border='0'>";
echo "<tr><td><img src='#' width='180' height='1'></td><form method='post' action='index.php?page=$page' enctype=\"multipart/form-data\"><td>";
echo "<input type='hidden' name='type' value='hosts'>";
echo "&nbsp;&nbsp;<b>Hosts</b><br>";
echo "&nbsp;&nbsp;<input type='file' name='userfile'>&nbsp;<input type='submit' value='Import'>($hrows hosts in db)";
echo "</td></form></tr>";
echo "<tr><td><img src='#' width='180' height='1'></td><form method='post' action='index.php?page=$page' enctype=\"multipart/form-data\"><td>";
echo "<input type='hidden' name='type' value='hostgroups'>";
echo "&nbsp;&nbsp;<b>Hostgroups</b><br>";
echo "&nbsp;&nbsp;<input type='file' name='userfile'>&nbsp;<input type='submit' value='Import'>($grows hostgroups in db)";
echo "</td></form></tr>";
echo "<tr><td><img src='#' width='180' height='1'></td><form method='post' action='index.php?page=$page' enctype=\"multipart/form-data\"><td>";
echo "<input type='hidden' name='type' value='services'>";
echo "&nbsp;&nbsp;<b>Services</b><br>";
echo "&nbsp;&nbsp;<input type='file' name='userfile' $disable>&nbsp;<input type='submit' value='Import' $disable>($srows services in db)";
echo "</td></form></tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>\n";

echo "\t\t</td>";
echo "\t</tr>";
echo "</table>\n";

?>	
Return current item: eNetman