#! /usr/bin/perl ### ### MAT - Management Account Tool (c)09/2002 - Kirk Waingrow ### ### Use at your own risk / Always test first before putting in production ### ### INSTALLATION: ### 1. Install base perl on linux or Windows (cygwin) webserver ### 2. Cut/paste this code into the cgi executable area of your web server ### 3. Make this script executable. ### 4. Update any Variables below. ### 5. Make sure DPATH has write permissions by the webserver. ### $VER="1.2 - Kirk Waingrow - 09/02"; $PROGNAME="mat_outages"; # name of the executable perl script $PROG="/cgi-bin/$PROGNAME"; # URL path to the executable script $DPATH="/var/www/data"; # change to where you want the data stored, check permissions writeable by webserver $MANAGENAME="Issues and Outages"; # Display the Tool Name $FIELD1="Outage Date"; $FLEN1=10; # Length of the input field $FIELD2="Hostname"; $FLEN2=10; $FIELD3="DownTown"; $FLEN3=8; $FIELD4="Problem"; $FLEN4=30; $FIELD5="Resolution"; $FLEN5=40; $FIELD6="Future Measures"; $FLEN6=30; $DATE=`date '+%Y/%m/%d'`; $FVAL1=""; # Set these if you want default entries. $FVAL2=""; $FVAL3=""; $FVAL5=""; $FVAL6=""; # # To add or delete fields modify $FIELDx $FVAL Abouve then # SEACH FOR /#CHANGE# AND MODIFY WHERE NEEDED # ------------------------------------------------------------------- $DATA="$DPATH/$PROGNAME.txt"; $COMMENT="$DPATH/$PROGNAME.cmt"; if ( ! -d "$DPATH" ) { `mkdir -p $DPATH`; } if ( ! -f "$DATA" ) { `touch $DATA`; } print "Content-type: text/html\n\n"; print qq~
";
}
## #CHANGE# if you want the date to autofill
$FVAL1="$DATE";
# GET DATA FROM THE DATA FILE TO BE EDITTED
sub get_data
{
$cnt=0;
open(IN, "$DATA");
while (
*** ERROR: ALL FIELDS MUST BE ENTERED *** ";
### #CHANGE# Add/Remove as needed
$FVAL1="$form{FIELD1}";
$FVAL2="$form{FIELD2}";
$FVAL3="$form{FIELD3}";
$FVAL4="$form{FIELD4}";
$FVAL5="$form{FIELD5}";
$FVAL6="$form{FIELD6}";
}
}
###
### TITLE BAR
###
$TOTALREC=`cat $DATA | wc -l | awk '{ print $1}'`;
print qq~
~;
###
### CAT A TEXT FILE FOR COMMENT AND INFORMATION
###
`touch $COMMENT`;
open(IN, "$COMMENT" );
while (
$MANAGENAME Manager
ACME XYZ Company
~;
}
}
Total Records = $TOTALREC
(ver. $VER)