\n"
."Click on the support link below to learn how to upgrade your config-file.";
&display_error;
}
}
#------( Read language-file, if any. )------
if ($language) {
if (open(LANGUAGEFILE,"<$language")) {
if (($languageline = \n"
."Click on the support link below to download the newest language-file.";
&display_error;
}
}
}
}
} else {
$error_message = "Couldn't read the configuration file: \"$0.config\"! \n\"$!\"\n";
&display_error;
}
}
#######################################################################
# The correct date.
#######################################################################
sub make_date {
($t,$t,$t,$mday,$mon,$thisyear,$t,$t,$t) = localtime(time);
$mon++;
if ($thisyear < 95) {$thisyear = "20$thisyear";} {$thisyear = "19$thisyear";}
$date = "$mday.$mon.$thisyear";
}
#######################################################################
# Read the FORM information.
# Split it into understandable data.
# Strip name, eMail and URL for Go back with your browser an retry.";
} elsif ($FORM{'location'} eq "nowhere") {
$form_ok = 0;
$error_message = "You have to select where you're located! " .
"Go back with your browser and retry.";
}
}
#######################################################################
# Add new signature to the guestbook-file.
#######################################################################
sub add_signature {
if (open(GUESTFILE,">>$data_file")) {
if (form_ok) {
print GUESTFILE " \n\"$!\"\n";
&display_error;
}
}
#######################################################################
# Make and show the guestbook HTML-document.
#######################################################################
sub make_htmlView {
$data_file = $FORM{'old_datafile'} if ($FORM{'old_datafile'} && $show_old_files);
if (open(GUESTFILE,"<$data_file")) {
undef $/;
$guestfile = ( $contributions ".($person?$person:"person has");
} else {
$signedline = " ( $contributions ".($people?$people:"people have");
}
$signedline .= " ".($signed_this?$signed_this:"signed this guestbook");
$signedline .= " ".($since?$since:"since")." ".($reverse_sort?$date:$first_date)." ) \n";
#------( Print the contents to screen )------
print "Content-type: text/html\n\n";
print " \n";
if ($show_old_files && !$FORM{'old_datafile'}) {
my $i = 1;
foreach $temp (@olddatafilesarray) {
$temp2 = $temp;
$temp2 =~ s/.*\/(.*)\..*/$1/;
print " \n\"$!\"\n";
&display_error;
}
}
#######################################################################
# Make and show the HTML sign-page.
#######################################################################
sub make_htmlForm {
print "Content-type: text/html\n\n";
print " \n";
print $error_message;
print " - The Author\n";
print " / Support";
print " -\n";
exit 0;
}
#######################################################################
# Send the new guestbook-entry as eMail to recipient.
#######################################################################
sub send_mail {
open (MAIL, "|$mailprogram $mailaddress");
print MAIL "RETURN-PATH: \<$mailadress\>\n";
print MAIL "FROM: message\@in_your_guest_book.org ($pagetitle)\n";
print MAIL "SUBJECT: New guestbook entry.\n\n";
print MAIL "$FORM{'name'} ";
print MAIL "".($from?$from:"from");
print MAIL " $FORM{'location'} ";
print MAIL "".($wrote?$wrote:"wrote on");
print MAIL " $date:\n";
print MAIL "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n";
if ($FORM{'message'} eq undef) {
print MAIL "\n<".($NoMsgWritten?$NoMsgWritten:"No message was written").">\n\n";
} else {
print MAIL "\n$FORM{'message'}\n\n";
}
print MAIL "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n";
close(MAIL);
}
1
-tags.
#######################################################################
sub extract_forminfo {
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
} else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, @values) = split(/=/, $pair);
$value = join ("=", @values);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
$FORM{'name'} =~ s/\<[^\>]*\>//ig;
$FORM{'name'} =~ s/\/g;
$FORM{'name'} =~ s/\>//g;
$FORM{'email'} = "\L$FORM{'email'}";
$FORM{'email'} =~ s/\<[^\>]*\>//ig;
$FORM{'email'} =~ s/\/g;
$FORM{'email'} =~ s/\>//g;
$FORM{'homepage'} = "\L$FORM{'homepage'}";
$FORM{'homepage'} =~ s/\<[^\>]*\>//ig;
$FORM{'homepage'} =~ s/\/g;
$FORM{'homepage'} =~ s/\>//g;
}
}
#######################################################################
# Test the guestbook-entry for errors. (No name etc.)
#######################################################################
sub test_form {
$form_ok = 1;
if ($FORM{'name'} eq "") {
$form_ok = 0;
$error_message = "You have to fill in your name in order to " .
"sign this guestbook!
\n";
}
#------( Here starts the generating of the HTML-entries )------
$all_entries .= "" if ($email_on_name && ($email =~ /.*@.*/));
$all_entries .= "$name ";
$all_entries .= "" if ($email_on_name && ($email =~ /.*@.*/));
if ($from) { $all_entries .= $from } else {$all_entries .= "from"};
$all_entries .= " $location ";
if ($message eq "\n") {
$all_entries .= "".($signed?$signed:"signed the guestbook on")." $date.\n
\n";
}
if (!(($homepage=~/^$/) || ($homepage=~/^http:\/\/$/)) && ($homepage=~/^http:\/\//)) {
$all_entries .= "URL: $homepage
\n";
}
$imagetext = "IMAGE";
$imagetext = $IMAGE if $IMAGE;
$linktext = "LINK";
$linktext = $LINK if $LINK;
if (!$show_images) {
$message =~ s/\\n".
"$message\n
\n".$all_entries."
\n";
print $signedline if $show_signed =~ /bottom/i;
print "";
print "Guestbook system v$cgi_version made by ";
print "Lars Ellingsen\n";
print "- Copyright © $thisyear
";
} else {
$error_message = "Couldn't read the guestbook datafile: \"$data_file\"
";
if ($Write) {
print $Write ." \"<BR>\" " . $AtTheEnd;
} else {
print "Write \"<BR>\" at the end of each line in your message!";
}
print "
Guestbook system v$cgi_version made by
Lars Ellingsen
- Copyright © $thisyear A guestbook-error was detected!