#!/usr/local/bin/perl use CGI; $CGI::POST_MAX=50; # max 100K posts $CGI::DISABLE_UPLOADS = 1; # no uploads ###################################################################### # BEFORE TRYING TO EDIT THIS SCRIPT, READ THE README FILE ###################################################################### # # The Dream Catcher's Web Free CGI Scripts # Book of Guests # Created by Seth Leonard # # http://dreamcatchersweb.com/scripts/ # # (c)2000 Seth Leonard # All Rights Reserved # ###################################################################### # ONLY EDIT THIS PART OF THE SCRIPT!!!! $guestlocation = "http://www.srmason-sj.org/guestbook.htm"; $guestpath = "../guestbook.htm"; $cgilocation = "http://www.srmason-sj.org/cgi-local/guestbook.cgi"; $mailprog = '/usr/lib/sendmail'; $youmail = 'jmehovic@srmason-sj.org'; $yourname = "Jasmin"; $getdate = "/bin/date"; # DO NOT EDIT BELOW THIS LINE!!!! ##################################################################### read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s/<([^>]|\n)*>//g; $INPUT{$name} = $value; } $date = `$getdate +"%A, %B %d, %Y at %T (%Z)"`; chop($date); &noname unless $INPUT{'name'}; open (FILE,"$guestpath"); @lines = ; close(FILE); open (GUEST,">$guestpath"); foreach $line (@lines) { if ($line =~ //) { print GUEST ("\n"); print GUEST ("$INPUT{'name'}
\n"); if ($INPUT{'email'}) { print GUEST (""); print GUEST ("$INPUT{'email'}
"); } if ($INPUT{'city'}) { print GUEST ("$INPUT{'city'}, "); } if ($INPUT{'state'}) { print GUEST ("$INPUT{'state'} "); } if ($INPUT{'country'}) { print GUEST (" $INPUT{'country'}
"); } if ($INPUT{'howfound'}) { print GUEST ("* $INPUT{'howfound'} *
"); } if ($INPUT{'url'} ) { print GUEST ("$INPUT{'title'}
"); } if ($INPUT{'comments'}) { $INPUT{'comments'} =~ s/\cM\n/
\n/g; $CGI::POST_MAX = 100; $mailcomments = $INPUT{'comments'}; $mailcomments =~ s/
//g; print GUEST ("$INPUT{'comments'}
"); } print GUEST ("-$date
\n\n"); } else { print GUEST ("$line"); } } close (GUEST); open (MAIL, "|$mailprog $youmail"); if ($INPUT{'email'}) { print MAIL ("From: $INPUT{'name'} <$INPUT{'email'}>\n"); } else { print MAIL ("From: $INPUT{'name'}\n"); } print MAIL ("Subject: Guestbook Signing\n\n"); print MAIL ("$INPUT{'name'} has signed your guestbook.\n\n"); print MAIL ("Here is the new entry:\n"); print MAIL ("$INPUT{'name'}\n"); if ($INPUT{'email'}) { print MAIL ("$INPUT{'email'}\n"); } if ($INPUT{'city'}) { print MAIL ("$INPUT{'city'}, "); } if ($INPUT{'state'}) { print MAIL ("$INPUT{'state'} "); } if ($INPUT{'country'}) { print MAIL (" $INPUT{'country'}\n"); } if ($INPUT{'howfound'}) { print MAIL ("* $INPUT{'howfound'} *\n"); } if ($INPUT{'url'}) { print MAIL ("$INPUT{'title'} url: $INPUT{'url'}\n"); } if ($INPUT{'comments'}) { print MAIL ("$mailcomments\n"); } print MAIL ("-$date\n"); close (MAIL); # Send info to visitor if ($INPUT{'email'}) { if ($INPUT{'email'} =~ /(.*)@(.*)/) { open (MAIL, "|-") || exec $mailprog,$INPUT{'email'} || die "Can't open $mailprog!\n"; print MAIL ("From: $yourname <$youmail>\n"); print MAIL ("Subject: Thanks\n\n"); print MAIL ("$INPUT{'name'},\n\n"); print MAIL ("Thank you for signing my guestbook! "); print MAIL ("You can see your entry at $guestlocation\n"); print MAIL ("Thanks again!\n\n"); print MAIL ("- $yourname\n\n"); close (MAIL); } } &htmlafter; # Error Messages sub noname { print ("Content-type: text/html\n\n"); print ("No Name\n"); print ("

You Didn't Leave Your Name...

\n"); print ("You didn't add your name so your entry to the guestbook was not added.\n"); print ("Please add your name below.
\n"); print ("\n"); print ("Your Name:
\n"); print ("\n"); print ("\n"); print ("\n"); print ("\n"); print ("\n"); print ("\n"); print ("
\n"); print ("\n"); exit; } # Print Follow Up HTML sub htmlafter { print ("Content-Type: text/html\n\n"); print ("Thank You\n"); print ("

Thank You For Signing The Guestbook

\n"); print ("Thank you for filling in my guestbook. Your entry has "); print ("been added.
\n"); print ("Here is what you added:

\n"); print ("$INPUT{'name'}
\n"); if ($INPUT{'email'}) { print (""); print ("$INPUT{'email'}
"); } if ($INPUT{'city'}) { print ("$INPUT{'city'}, "); } if ($INPUT{'state'}) { print ("$INPUT{'state'} "); } if ($INPUT{'country'}) { print (" $INPUT{'country'}
"); } if ($INPUT{'howfound'}) { print ("$INPUT{'howfound'}
"); } if ($INPUT{'url'}) { print ("$INPUT{'title'}
"); } if ($INPUT{'comments'}) { print ("$INPUT{'comments'}
"); } print ("-$date
"); print ("Back to the Guestbook. \n"); print ("If you do not see your addition, hit RELOAD
\n"); print ("Would you like a guestbook like this one? \n"); print ("Then go "); print ("Here\n"); exit; }