#!/usr/local/bin/perl ####################################################### # Program - Guestbook - version 3.0 # # Updated April 16, 1998 # # # # This is a Guestbook program that logs the Name, # # E-mail, URL, City, State and a Comment. The # # person, however, must enter their Name, E-mail, # # and a Comment. # # # # MAKE SURE THAT YOU READ OVER THE TERMS OF AGREEMENT # # BEFORE USING THIS SCRIPT. BY USING THIS SCRIPT, # # YOU ARE AGREEING TO ABIDE BY THEM. HOWEVER, IF YOU # # DON'T AGREE WITH IT, THEN DON'T USE MY SCRIPTS. # # PLEASE READ THE 'README.TXT' FILE BEFORE INSTALLING.# # KEEP IN MIND THAT JASON'S SCRIPTS & THE AESTHETIC # # SURGERY CENTER SHALL NOT BE HELD LIABLE FOR ANY # # DAMAGES THAT MAY OCCUR FROM DOWNLOADING AND/OR # # INSTALLING MY PROGRAMS. USE AT YOUR OWN RISK! # # # # A Few liness came from Matt's Scripts @ # # http://www.worldwidemart.com/scripts # ####################################################### $directory_gbook = "/usr/users/guestbook/guestbook.html"; $guestbook = "http://www.yourdomain.com/guestbook/guestbook.html"; $cgi = "http://www.yourdomain.com/guestbook/guest.cgi"; $base = "http://www.yourdomain.com/guestbook/"; $gif1 = "add.gif"; $gif2 = "miss.gif"; $gif3 = "thanks.gif"; $gif4 = "blueline.gif"; $mail = 1; $mailto = 'user@yourcompany.com'; ############################################################ #Don't touch, these are necessary to run the script! $mailprog = '/usr/lib/sendmail'; $entry = 1; $allow = 1; $date_command = "/usr/bin/date"; ############################################################ $date = `$date_command +"%B %d, %Y"`; chop($date); 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; if ($allow != 1) { $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; } ######## #Checks to see that the comments, name and e-mail address were added! &no_comments unless $FORM{'comments'}; &no_name unless $FORM{'name'}; &no_email unless $FORM{'email'}; ###### #Checks to see if the E-mail address is in the normal form, #yourname@yourcompany.com if (&email_check($FORM{'email'})) { } else { &no_email; } ####### #Opens 'guestbook.html' for writting open (FILE,"$directory_gbook") || die "Can't Open $directory_gbook: $!\n"; @LINES=; close(FILE); $SIZE=@LINES; # Open Link File to Output open (GUEST,">$directory_gbook") || die "Can't Open $directory_gbook: $!\n"; for ($i=0;$i<=$SIZE;$i++) { $_=$LINES[$i]; if (//) { if ($entry eq '1') { print GUEST "\n"; } print GUEST "\n"; if ( $FORM{'name'}) { print GUEST "\n"; } if ($FORM{'email'}) { print GUEST "\n"; } if ($FORM{'url'} ne "http://") { print GUEST "\n"; } else { } if ( $FORM{'city'} ){ print GUEST "\n"; } print GUEST " \n"; print GUEST "
Name: $FORM{'name'} - $date
E-mail: $FORM{'email'}
My URL: $FORM{'url'}
Location: $FORM{'city'}"; print GUEST ", $FORM{'state'}     $FORM{'country'}
Comments:  $FORM{'comments'}

\n"; print GUEST "


\n\n\n"; if ($entry eq '0') { print GUEST "