#!/usr/local/bin/perl -- -*- C -*- ###################################################################### # This File Takes input from the file # http://evlweb/~johnny/seminar/guestbook.html # Crunches the info then appends it to the file. # It was written by Johnny Lawson for a seminar 1996. # Here's the credit for the start-up code: # Copyright (C) 1994 Steven E. Brenner require "cgi-lib.pl"; MAIN: { # Read in all the variables set by the form &ReadParse(*input); print &PrintHeader; print "\n"; print "\n"; print "Guestbook output \n"; print "

This is what you entered:

\n"; # Do some processing, and print some output ($text = $input{'text'}) =~ s/\n/\n
/g; # replace \n with
print "$input{name}\n"; print "
$input{email}
\n"; print "$input{url}\n"; print "
"; &guestbook_cruncher; &mail_it; } sub guestbook_cruncher { open(IN, "guestbook.html"); @file = ; foreach $line ( @file ){ $cnt = $cnt + 1; if (( $line =~ /<\/html>/i) || ( $line =~ /<\/body>/i)) { #print "line $cnt has a end of hypertesxt flag!\n"; $line =~ s/<\/html>//i; $line =~ s/<\/body>//i; } } if ( $input{url} eq "" ) { $people = "$input{name} $input{email}
\n"; } else { $people = "
  • $input{name} $input{email}
    \n"; } print @file = ( @file, $people ); open(OUT, ">guestbook.html"); print OUT @file; close(OUT); } sub mail_it{ $sub = "-s \"Guestbook Robot Report\""; open(MAIL, "|Mail $sub johnny\@evl.eecs.uic.edu" ); print MAIL "My Dearest Friend, I prey this message finds you in good spirts and that all is well. It brings me, your humble servent, the greatest of pleasures to inform you that a person named \"$input{name}\" has honered us with a entry in our guestbook! \t\tYours, \t\t\tDinsDale, Seminar Guestbook Robot"; close(MAIL); }