sub CheckForMsgs { my $strMsg = ''; my @MsgArray = (); my $MsgDate = 0; my $Message = ''; my $GuestName = ''; my $id = 0; my $colorflag = 0; my $bgcolor = "#FFFFCC"; # open the file for read open(DAT,"Guestbook.cgi") || die("Cannot Open File:$!"); @MsgArray = ; close(DAT); foreach $id (@MsgArray) { chomp ($id); ($id,$MsgDate,$GuestName,$Message)=split (/\|/,$id); # alternate table row background color to contrast entries. if ($id%2 eq 1){ $bgcolor = "#FFFFCC"; $strMsg .= "\ $MsgDate $GuestName $Message \n"; } else { $bgcolor = "#DFDF00"; $strMsg .= "\ $MsgDate $GuestName $Message \n"; } } return $strMsg; }; ####End of Sub sub WriteNewMsg { my @MsgArray = (); my $id = 0; my $NewMsg = ''; my $GuestName = ''; my $now_string = strftime "%a %b%e %H:%M %Y", localtime; my $NewID = 1; &ReadParse(*input); # open the file for read open(DAT,"Guestbook.cgi") || die("Cannot Open File:$!"); @MsgArray = ; close(DAT); open(DAT,">>Guestbook.cgi") || die("Cannot Open File:$!"); foreach $id (@MsgArray) { chomp ($id); ($id,$MsgDate,$GuestName,$NewMsg)=split (/\|/,$id); ++$NewID; } # add Event to file print DAT "$NewID|$now_string|$input{'txtGuestName'}|$input{'txtMsg'}\n"; close(DAT); }; ###End of Sub