New record saved
\n";
$typeid=stripslashes(pgdatatrim(relatedata($dbsocket,"Syslog_TPremadeType","TPremadeType_ID","TPremadeType_Desc='$typedesc'")));
$action = "Modify";
}
if ( ( $subaction == 2 ) && ( $action == "Save" ) && ( idexist($dbsocket,"Syslog_TPremadeType","TPremadeType_ID",$typeid) ) &&
( pgdatatrim($typedesc) != "" ) ) {
updateequiptype($dbsocket,$typeid,$typedesc, $logwatch);
$actiontext="Record updated
\n";
}
if ( ( $DeleteID == 1 ) && ( $subaction == 3 ) && ( $action == "Delete" ) &&
( idexist($dbsocket,"Syslog_TPremadeType","TPremadeType_ID",$typeid) ) ) {
if ( numberofhostsusingtype($dbsocket,$typeid) < 1 ) {
dropequiptype($dbsocket,$typeid);
$actiontext="Record deleted
\n";
} else {
$actiontext="Cannot delete record because hosts already reference premade type
\n";
}
$action="Deleted";
}
if ( $action == "Add" ) {
$subaction = 1;
$typeid = "";
}
if ( $action == "Modify" ) {
$subaction = 2;
$typedesc=stripslashes(pgdatatrim(relatedata($dbsocket,"Syslog_TPremadeType","TPremadeType_Desc","TPremadeType_ID=$typeid")));
$logwatch=stripslashes(pgdatatrim(relatedata($dbsocket,"Syslog_TPremadeType","logwatch_cmd","TPremadeType_ID=$typeid")));
}
if ( $action == "Delete" ) {
$subaction = 3;
$typedesc=stripslashes(pgdatatrim(relatedata($dbsocket,"Syslog_TPremadeType","TPremadeType_Desc","TPremadeType_ID=$typeid")));
$logwatch=stripslashes(pgdatatrim(relatedata($dbsocket,"Syslog_TPremadeType","logwatch_cmd","TPremadeType_ID=$typeid")));
}
openform("equiptype.php","post",2,1,0);
echo "Equipment Type
\n";
if ( $subaction != 3 ) {
echo "1. Enter Equipment Type: ";
formfield("typedesc","text",3,1,1,40,40,$typedesc);
echo "2. Enter Logwatch Command Line: ";
echo "
";
formsubmit("Save",3,1,0);
formfield("subaction","hidden",3,1,0,200,200,$subaction);
if ( $typeid != "" ) { formfield("typeid","hidden",3,1,0,200,200,$typeid); }
closeform();
} else {
if ( ( $subaction == 3 ) && ( $action == "Delete" ) ) {
openform("equiptype.php","post",2,1,0);
formfield("typeid","Hidden",3,1,0,200,200,$typeid);
formfield("subaction","Hidden",3,1,0,10,10,$subaction);
echo "Are you sure you want to delete $typedesc? ";
php?>
Yes
No
Page loaded in " . ($endtime - $begintime) . " seconds.
\n";
do_footer();
dbdisconnect($sec_dbsocket);
dbdisconnect($dbsocket);
php?>