Location: PHPKode > projects > Cancerbero - The watchdog of the ports > cancerbero-0.6/site/index.php
<?php

@session_start ();

include_once("include/dbconnect.php");
include_once("include/read_config_class.php");
include_once("menu.html");
include_once('include/class_history_links.inc');


$config = new ReadConfig;
if ($config->database_version != DATABASE_VER) {
	include_once ("upgrade.php");
	echo "</tr>\n";
	echo "</table>";
	echo "</div>";
	echo "<p>";
	exit;
}

include_once ("include/functions.php");

$general = $config->General('gui_debug');
if ($general['gui_debug'] == 1) {
	echo "<div align='center' class='orange'><h2><blink>Debug mode activated</blink></h2></div>";
}

$query_sensors = mysql_query("select s.sensor_id,sensor_name sensor,saw_alive as alive,num_sub_nmaps as scans,FROM_UNIXTIME(date_prev, '%Y-%m-%d / %k:%i') as last_sweep,FROM_UNIXTIME(date_next, '%Y-%m-%d / %k:%i ') as next_sweep,status_sweep from sensors s,program_values p where s.sensor_id = p.sensor_id") or die (mysql_error());

echo "<div class='row'>\n";
echo "<table class='cancerbero' border = 1>\n";
echo "<tr>\n";
echo "<th>\n";
echo "<h2>Sensors</h2>";
echo "</th>\n";
echo "<th>\n";
echo "<h2>Action</h2>";
echo "</th>\n";
echo "<th>\n";
echo "<h2>Active Scans</h2>";
echo "</th>\n";
echo "<th>\n";
echo "<h2>Last Sweep</h2>";
echo "</th>\n";
echo "<th>\n";
echo "<h2>Next Sweep</h2>";
echo "</th>\n";
echo "<th>\n";
echo "<h2>Status</h2>";
echo "</th>\n";
echo "</tr>\n";

$general = $config->General('check_alive');

$actual_time = time();
$num_of_sensors = 0;
while ($sensors = mysql_fetch_assoc($query_sensors)) {
	$num_of_sensors++;
	echo "<tr>\n";
	show_line ("Sensor",$sensors['sensor'],$sensors);
	#echo "<td><h3>$sensors[sensor]<h3></td>";
	if ( ($actual_time - $sensors['alive']) <= ($general['check_alive']) ) {
		if ($sensors['scans'] > 0) {
			show_line ("action","<div onmouseover=\"return escape('Sensor is Scanning.<br>.')\"><FONT COLOR=\"#00FF00\">Scanning</FONT></div>",$sensors);
		} else {
			show_line ("action","<div onmouseover=\"return escape('Sensor is $sensors[status_sweep].')\"><FONT COLOR=\"#00FF00\" onmouseover=\"return escape('Status.')\">$sensors[status_sweep]</FONT></div>",$sensors);
		}
		show_line ("scans","<div onmouseover=\"return escape('Number of scans performing now: $sensors[scans].')\"> $sensors[scans] </div>","sensors");
		show_line ("last_sweep",$sensors['last_sweep'],"sensors");
		show_line ("next_sweep",$sensors['next_sweep'],"sensors");
		show_line ("icon_green","<IMG title=Up src='icons/up.png'>",$sensors);
	} else {
		show_line ("icon_red","<div onmouseover=\"return escape('Sensor is Down.<br>No discover or scans will be done.')\"><FONT COLOR=\"#FF0000\">Down</FONT></div>",$sensors);
		show_line ("scans","<div onmouseover=\"return escape('Number of scans performing now: $sensors[scans]')\">0</div>","sensors");
		show_line ("last_sweep",$sensors['last_sweep'],"sensors");
		show_line ("next_sweep","unknown","sensors");
		show_line ("icon_red","<IMG title=Down src='icons/stop.png'>",$sensors);
	}
	echo "</tr>\n";
}

if ($num_of_sensors == 0) {
	echo "<tr>";
	echo "<div align='center'><h1>Sorry there is not any sensor registered in Cancerbero<br></h1><div>";
}
echo "</tr>\n";
echo "</table>";
echo "</div>";
?>

<div class='row'>
&nbsp;
</div>

</div>
</div>

<script language="JavaScript" type="text/javascript" src="include/wz_tooltip.js"></script>

</body>
</html>
Return current item: Cancerbero - The watchdog of the ports