#!/usr/bin/perl use DBI; # Guestbook Version 2.3.1 # # Copyright 1996 Matt Wright mattw@worldwidemart.com # # Created 4/21/95 Last Modified 10/29/95 # # Scripts Archive at: http://www.worldwidemart.com/scripts/ # # COPYRIGHT NOTICE # # Copyright 1996 Matthew M. Wright All Rights Reserved. # # # # Guestbook may be used and modified free of charge by anyone so long as # # this copyright notice and the comments above remain intact. By using this # # code you agree to indemnify Matthew M. Wright from any liability that # # might arise from it's use. # # # # Selling the code for this program without prior written consent is # # expressly forbidden. In other words, please ask first before you try and # # make money off of my program. # # # # Obtain permission before redistributing this software over the Internet or # # in any other medium. In all cases copyright and header must remain intact.# # Set Variables $dbh = DBI->connect ("DBI:mysql:host=localhost;database=my_db", "my_id", "my_pass", {PrintError => 0, RaiseError => 1}); $guestbookurl = "http://www.usedflutes.com/confirmation.html"; $sth = $dbh->prepare($guestbookreal); $sth->execute(); $guestlog = "/home/yourname/public_html/guestlog.html"; $cgiurl = "http://64.177.252.244/home/flute/usedflutes-www/cgi-bin/guestbook.pl "; $date_command = "/bin/date"; # Set Your Options: $mail = 1; # 1 = Yes; 0 = No $uselog = 0; # 1 = Yes; 0 = No $linkmail = 1; # 1 = Yes; 0 = No $separator = 1; # 1 =
$redirection = 1; # 1 = Yes; 0 = No
$entry_order = 1; # 1 = Newest entries added first;
# 0 = Newest Entries added last.
$remote_mail = 1; # 1 = Yes; 0 = No
$allow_html = 0; # 1 = Yes; 0 = No
$line_breaks = 0; # 1 = Yes; 0 = No
# If you answered 1 to $mail or $remote_mail you will need to fill out
# these variables below:
$mailprog = '/usr/lib/sendmail';
$recipient = 'listings@usedflutes.com';
$updates = 'updates@usedflutes.com';
# Done
# Get the Date for Entry
$date = `$date_command +"%A, %B %d, %Y "`; chop($date);
$shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
unless ($name eq 'username' or $name eq 'url') {
$value = ucfirst($value);
}
if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}
if($name eq 'username') {
$FORM{$name} = $value;
} else {
$FORM{$name} = $dbh->quote($value);
}
}
# Print the Blank Response Subroutines
&no_comments unless $FORM{'comments'};
&no_name unless $FORM{'realname'};
# chop comments field down to max if necessary
$FORM{'comments'} = substr($FORM{'comments'},0,640) unless (length($FORM{'comments'}) <= 640);
# URL biz
$FORM{'url'} = "''" if $FORM{'url'} eq "'http://'";
# Begin the Editing of the Guestbook File
open (FILE,"$guestbookreal") || die "Can't Open $guestbookreal: $!\n";
@LINES=