<?
session_start();
require_once("../classes/network.php");
require_once("../classes/user.php");
// Create a User instance
$user = new User();
$network = new Network();
if (!$user->IsLoggedIn())
header("Location: index.php");
else if (!$user->IsAdmin())
header("Location: logout.php");
if ($update==1){
// this means a update button was pushed and the side was reloaded
$updatenetwork=new Network();
$result=$updatenetwork->updateProcessInfo($newprocess_id,$newsleep_time_snmp,$newsleep_time_data,$newsleep_time_ping);
}
function printProcessInfo(){
$network = new Network();
$user = new User();
$result = $network->GetProcessDetails();
while(List( $process_id,$sleep_time_snmp,$sleep_time_data,$sleep_time_ping,$start_time_snmp,$stop_time_snmp,$start_time_data,$stop_time_data,$start_time_ping,$stop_time_ping) = $network->FetchRow($result))
{
if($user->IsAdmin())print "<form name=\"changerow".$process_id."\" method=\"get\" action=\"procsetup.php\">";
print "<tr bgcolor=\"#fcfcfc\">";
print "<td>".$process_id."</td>";
$looptime = $stop_time_snmp - $start_time_snmp;
print "<td>".$looptime." secs"."</td>";
if($user->IsAdmin())print "<td width=\"50\"><input name=\"newsleep_time_snmp\" type=text size=\"3\" value=\"$sleep_time_snmp\"></td>";
$looptime = $stop_time_data - $start_time_data;
print "<td>".$looptime." secs"."</td>";
if($user->IsAdmin())print "<td width=\"50\"><input name=\"newsleep_time_data\" type=text size=\"3\" value=\"$sleep_time_data\"></td>";
$looptime = $stop_time_ping - $start_time_ping;
print "<td>".$looptime." secs"."</td>";
if($user->IsAdmin())print "<td width=\"50\"><input name=\"newsleep_time_ping\" type=text size=\"3\" value=\"$sleep_time_ping\"></td>\n";
print "<input type=\"hidden\" name=\"newprocess_id\" value=\"$process_id\">";
print "<input type=\"hidden\" name=\"update\" value=\"1\">";
//print "<td><input type=\"button\" onCLick=\"Javascript: savechanges(".$process_id.")\" name=\"update\" value=\"Update\"></td>\n";
print "<td><input type=\"submit\" name=\"updatebut\" value=\"Update\"></td>\n";
print "</tr>";
print "</form>";
}
}
?>
<html>
<head>
<title>Process Setup</title>
<link href="css/style1.css" rel="styleSheet" type="text/css">
<script language="javascript">
function savechanges(process_id)
{
window.location = "procsetup.php?update=1&process_id="+process_id;
}
</script>
</head>
<body>
<? include("menuinclude.php");?>
<form method="post" name="settings">
<table width = "50%" height="80%" align="center" border="0">
<tr>
<td>
<!-- background table -->
<table width="500" align="center" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000">
<tr>
<td>
<!-- gui table -->
<table width="500" border="0" cellspacing="1" cellpadding="2">
<!-- title row -->
<tr>
<td bgcolor="#515173" colspan="7">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><b>Process setup and information</b></font>
</td>
</tr>
<tr>
<td bgcolor="#c0c0c0" colspan="7">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
Configuration changes made here may take several minuets before they take effect!<br>
</font>
</td>
</tr>
<!-- Submit -->
<tr bgcolor="#fcfcfc">
<td>
<table width="100%" border="0">
<tr>
<td align="top "width="50">Process ID<br><br></td>
<td width="50"> Current loop time SNMP</td>
<td width="50"> Current sleep-time SNMP</td>
<td width="50"> Current loop time DATA</td>
<td width="50"> Current sleep-time DATA</td>
<td width="50"> Current loop time PING</td>
<td width="50"> Current sleep-time PING</td>
</tr>
<? printProcessInfo();?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>