<?php
// (C)Copyright John Baker 2004/2005/2006
//
// This file is part of lsms2mrtg.
//
// lsms2mrtg is free software;you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation;either version 2 of the License, or
// (at your option) any later version.
//
// lsms2mrtg is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY;without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with lsms2mrtg;if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// For more informationn please visit http://gnulsms2mrtg.sourceforge.net/
include '../generic.inc';
include '../jbsnmplib.inc';
include '../BrickSNMPlib.inc';
echo $htmlheader;
echo "<body onload=\"document.pingeradd.pingdesc.focus()\">";
//error_reporting(2);
echo "<font size=+2 color=$globaltitlecolour><B>PHP Pinger Editor</B></font><HR><BR>";
if (file_exists("run.pinger")) {
$tmp1=file2array("run.pinger");
$listend=$tmp1[0];
}
else
{
$listend=0;
}
$cmdcounter1=0;
$cmdcounter2=0;
$refreshpage=(30+($listend*2));
$pinglist=array();
if ($listend!=0) {
$pingerlist=$tmp1[1];
SORT($pingerlist);
echo "<TABLE valign=middle cellpadding=0 border=1 bgcolor=$gentablebg bordercolor=$gentableborder class=\"framelook\" >";
echo "<TH><font color=$gentabletext>Description</TH><TH><font color=$gentabletext>Host/Address</TH><TH><font color=$gentabletext>Pings</TH><TH><font color=$gentabletext>VNC</TH><TH><font color=$gentabletext>WWW</TH><TH><font color=$gentabletext>Telnet</TH><TH><font color=$gentabletext>FTP</TH>";
echo "<TH><font color=$gentabletext>SNMP</TH>";
echo "<TH><font color=$gentabletext>Disabled</TH>";
echo "<TH><font color=$gentabletext>Update</TH><TH><font color=$gentabletext>Del</TH><TH><font color=$gentabletext>Action</TH>";
while ($cmdcounter1 <= $listend)
{
$readpingerline=$pingerlist[$cmdcounter1];
list($pingdesc,$pinghost,$pingcount,$pingvnc,$pingwww,$pingtelnet,$pingwwwport,$pingftp,$pingsnmp,$pingcommunity,$pingactive,$pinghttps) = split(",", $readpingerline);
if (strlen($readpingerline)>4) {
$tmparray1=array($pingdesc,$pinghost,$pingcount,$pingvnc,$pingwww,$pingtelnet,$pingwwwport,$pingftp,$pingsnmp,$pingcommunity,$pingactive,$pinghttps);
$pinglist[]=$tmparray1;
echo "<TR><form name=pingedit$cmdcounter2 action=update.php>";
echo "<input type=hidden name=pingline value=$cmdcounter2>";
echo "<TD class=\"celllook\"><input type=text size=16 maxlength=64 name=pingdesc value=\"".trim($pingdesc)."\"></TD>";
echo "<TD class=\"celllook\"><input type=text size=16 maxlength=128 name=pinghost value=\"".trim($pinghost)."\"></TD>";
echo "<TD class=\"celllook\"> ";
if ($pingcount>0) {
echo "<center><input type=checkbox name=pingcount checked style=\"background : $gentablebg; color : $gentabletext\">";
}
else
{
echo "<center><input type=checkbox name=pingcount style=\"background : $gentablebg; color : $gentabletext\" >";
}
echo "</TD>";
echo "<TD class=\"celllook\">";
if ($pingvnc==1) {
echo "<center><input type=checkbox name=pingvnc checked style=\"background : $gentablebg;
color : $gentabletext\">";
}
else
{
echo "<center><input type=checkbox name=pingvnc style=\"background : $gentablebg; color : $gentabletext\" >";
}
echo "</center></TD>";
echo "<TD class=\"celllook\">";
if ($pingwww==1) {
echo "<input type=checkbox name=pingwww checked style=\"background : $gentablebg; color : $gentabletext\">";
}
else
{
echo "<input type=checkbox name=pingwww style=\"background : $gentablebg; color : $gentabletext\" >";
}
if ($pingwwwport=="") {
$pingwwwport="80";
}
echo "<input type=text size=5 maxlength=5 name=pingwwwport value=$pingwwwport>";
if ($pinghttps=="") {
$pinghttps="http";
}
echo "<select name=pinghttps>";
if (trim($pinghttps)=="http") {
echo "<option value=\"http\" SELECTED>HTTP</OPTION>";
echo "<option value=\"https\">HTTPS</OPTION>";
}
else
{
echo "<option value=\"https\" SELECTED>HTTPS</OPTION>";
echo "<option value=\"http\">HTTP</OPTION>";
}
echo "</select>";
echo "</TD>";
echo "<TD class=\"celllook\">";
if ($pingtelnet==1) {
echo "<center><input type=checkbox name=pingtelnet checked style=\"background : $gentablebg; color : $gentabletext\">";
}
else
{
echo "<center><input type=checkbox name=pingtelnet style=\"background : $gentablebg; color : $gentabletext\" >";
}
echo "</center></TD>";
echo "<TD class=\"celllook\"><center>";
if ($pingftp==1) {
echo "<center><input type=checkbox name=pingftp checked style=\"background : $gentablebg; color : $gentabletext\">";
}
else
{
echo "<center><input type=checkbox name=pingftp style=\"background : $gentablebg; color : $gentabletext\" >";
}
echo "</center></TD>";
echo "<TD class=\"celllook\"><center>";
if ($pingsnmp==1) {
echo "<center><input type=checkbox name=pingsnmp checked style=\"background : $gentablebg; color : $gentabletext\">";
echo "<input type=text name=pingcommunity size=6 maxlength=32 value=\"".trim($pingcommunity)."\">";
}
else
{
echo "<center><input type=checkbox name=pingsnmp style=\"background : $gentablebg; color : $gentabletext\" >";
echo "<input type=text name=pingcommunity size=6 maxlength=32 value=\"".trim($pingcommunity)."\">";
}
echo "</center></TD>";
echo "<TD class=\"celllook\"><center>";
if ($pingactive==1) {
echo "<center><input type=checkbox name=pingactive checked style=\"background : $gentablebg; color : $gentabletext\">";
}
else
{
echo "<center><input type=checkbox name=pingactive style=\"background : $gentablebg; color : $gentabletext\" >";
}
echo "</center></TD>";
echo "<TD class=\"celllook\"><center><input type=\"radio\" name=\"command\" value=\"update\" checked style=\"background : $gentablebg;
color : $gentabletext\"> </center></TD>";
echo "<TD class=\"celllook\"><center><input type=\"radio\" name=\"command\" value=\"delete\" style=\"background : $gentablebg; color : $gentabletext\"> </center></TD>";
echo "<TD class=\"celllook\"><input type=submit value=\"Action\" name=\"Action\"></TD>";
$cmdcounter2++;
echo "</TR>";
echo "</form>";
}
$cmdcounter1++;
}
echo "</table>";
}
if ($listend==0) {
Echo "No addresses to check, please add some<BR>";
}
echo "<BR><B>Add entry</B><BR>";
echo "<TABLE valign=middle cellpadding=0 border=1 bgcolor=$gentablebg bordercolor=$gentableborder class=\"framelook\" >";
echo "<TH><font color=$gentabletext>Description</TH><TH><font color=$gentabletext>Host/Address</TH><TH><font color=$gentabletext>Pings</TH><TH><font color=$gentabletext>VNC</TH><TH><font color=$gentabletext>WWW</TH><TH><font color=$gentabletext>Telnet</TH><TH><font color=$gentabletext>FTP</TH><TH>SNMP</TH><TH><font color=$gentabletext>Disabled</TH><TH><font color=$gentabletext>Add</TH>";
echo "<TR><form name=pingeradd action=update.php>";
echo "<TD class=\"celllook\"><input type=text name=pingdesc></TD>";
echo "<TD class=\"celllook\"><input type=text name=pinghost></TD>";
echo "<input type=hidden name=command value=\"add\">";
echo "<TD class=\"celllook\">";
echo "<center><input type=checkbox name=pingcount checked style=\"background : $gentablebg; color : $gentabletext\">";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingvnc style=\"background : $gentablebg; color : $gentabletext\" >";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingwww style=\"background : $gentablebg; color : $gentabletext\" >";
echo "<input type=text size=5 maxlength=5 name=pingwwwport value=80>";
echo "<select name=pinghttps>";
echo "<option value=\"http\" SELECTED>HTTP</OPTION>";
echo "<option value=\"https\">HTTPS</OPTION>";
echo "</select>";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingtelnet style=\"background : $gentablebg; color : $gentabletext\" >";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingftp style=\"background : $gentablebg; color : $gentabletext\" >";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingsnmp style=\"background : $gentablebg; color : $gentabletext\" >";
echo "<input type=text name=pingcommunity size=6 maxlength=32 value=\"public\">";
echo "</TD>";
echo "<TD class=\"celllook\">";
echo "<input type=checkbox name=pingactive style=\"background : $gentablebg; color : $gentabletext\" >";
echo "</TD>";
echo "<TD><input type=submit value=\"Add\"></TD>";
echo "</form>";
echo "</table>";
echo "<BR>";echo "<table><TR><TD>";
jsrefresh();
echo "</TD><TD>";
echo jsinputbutton("View","index.php");
echo "</td></TR></table>";
?>