#!/usr/bin/perl print ("Content-type: text/html\n\n"); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ #substitute all require files here for the file require "gb_variables.pl"; require "ugb_lib.pl"; require "gb_styles.pl"; }; &ReadParse; #adjust bgcolor variables if ($BGColor ne ""){ $BGColor = qq(bgcolor="$BGColor"); } if ($TableColorStrip ne "") { $TableColorStrip = qq(bgcolor="$TableColorStrip"); } if ($AltRowColor1 ne "") { $AltRowColor1 = qq(bgcolor="$AltRowColor1"); } if ($AltRowColor2 ne "") { $AltRowColor2 = qq(bgcolor="$AltRowColor2"); } if ($PageBackground ne "") { $PageBackground = qq(background="$PageBackground"); } if ($TableBorderColor ne ""){ $TableWidth2 = "100%"; $BorderTop = qq(
); $BorderBottom = qq( |
); } else { $TableWidth2 = $TableWidth; $BorderTop = "";
$BorderBottom = ""; } if (@in == 0) { &Summary; } if ($in{'action'} eq
"summary") { &Summary; } if ($in{'action'} eq "addentry") {
&AddEntry; } if ($in{'action'} eq "submitentry") { &SubmitEntry; } sub
SubmitEntry { if (($in{'Field1Value'} eq "") || ($in{'Field1Value'} !~
/[a-zA-Z0-9]/)) { &StandardHTML("You must complete the \"$Field1 \"
field in order to submit your entry. You must include at least one letter or
number."); exit; } if (($in{'Field4Value'} eq "") || ($in{'Field4Value'} !~
/[a-zA-Z0-9]/)) { &StandardHTML("You must complete the \"$Field4\"
field in order to submit your entry. You must include at least one letter or
number."); exit; } &GetDateTime; #get current date and time #add entry to
entries.file if ($TimeFormat eq "US") { $ThisTime = $USTime; } else { $ThisTime
= $EuroTime; } if ($DateFormat eq "US") { $ThisDate = "$USDate"; }
elsif ($DateFormat eq "USExpanded") { $ThisDate = "$USDateExpanded"; }
elsif ($DateFormat eq "Euro") { $ThisDate = "$EuroDate"; } else {
$ThisDate = "$EuroDateExpanded"; } $Field1Value =
&decodeURL($in{'Field1Value'}); $Field1Value = &CleanThis($Field1Value);
$Field1Value = &PipeCleaner($Field1Value); $Field2Value =
&decodeURL($in{'Field2Value'}); $Field2Value = &CleanThis($Field2Value);
$Field2Value = &PipeCleaner($Field2Value); $Field3Value =
&decodeURL($in{'Field3Value'}); $Field3Value = &CleanThis($Field3Value);
$Field3Value = &PipeCleaner($Field3Value); $Field4Value =
&decodeURL($in{'Field4Value'}); $Field4Value = &PipeCleaner($Field4Value); #HTML
NOT ALLOWED IN FIRST 3 FIELDS! $Field1Value =~ s/<.+?>//g; $Field2Value =~ s/<.+?>//g; $Field3Value
=~ s/<.+?>//g; if ($Field2Value ne "") { if ($Field2Hyper eq "url") { if
($Field2Value =~ /http:/) { $Field2Value = qq($Field2Value); }
else { $Field2Value = qq($Field2Value); } } elsif
($Field2Hyper eq "email") { $Field2Value = qq($Field2Value);
} else { $Field2Value = $Field2Value; } } #end Field2Value ne "" if
($Field3Value ne "") { if ($Field3Hyper eq "url") { if ($Field3Value
=~ /http:/) { $Field3Value = qq($Field3Value); } else {
$Field3Value = qq($Field3Value); } } elsif ($Field3Hyper
eq "email") { $Field2Value = qq($Field3Value);
} else { $Field3Value = $Field3Value; } } #end Field3Value ne "" if ($HTMLAllow
ne "yes") { $Field4Value =~ s/<.+?>//g; } $Field4Value = &Truncate($Field4Value);
$Field4Value = &ConvertReturns($Field4Value); if ($Censor eq "ON") {
@censored = split(/ /, $censorwords); $Field4Value =
&CensorCheck("$Field4Value"); } #Smiley/Frown conversion--- $Field4Value =
&Smilies("$Field4Value"); #UBB Code-ify (if allowed) if ($UBBCodeAllow eq
"yes") { $Field4Value = &UBBCode("$Field4Value"); } #END UBB CODE
#determine ID NUMBER if (-e "$GB_NON_CGI_Path/entries.file") { open (OLDENTRIES,
"$GB_NON_CGI_Path/entries.file") || die ("Couldn't open guestbook entries
file."); @entries =
$UBBLine $HTMLLine
ENDTABLE &BottomHTML; } # end Add Entry sr sub Summary { &TopHTML; print <<_top_of_page;
$IntroText
To add your entry, click here!
_TOP_OF_PAGE &GetEntries; print <<_bottom_html; $BorderBottom
Guestbook Admin Center | $ContinueWording |
_BOTTOM_HTML &BottomHTML; } #end Summary sr sub UpdateEntries { if
(-e "$GB_NON_CGI_Path/entries.file") { open (ENTRIES,
"$GB_NON_CGI_Path/entries.file") || die ("Couldn't open guestbook entries
file."); @entries =
GUTS if ($entryline[3] ne "") { print<
THELINE } if ($entryline[4] ne "") { print<
THELINE } print<
$entryline[5]
Guts2 if ($AlternateColor eq "$AltRowColor1") { $AlternateColor = "$AltRowColor2"; } else { $AlternateColor = "$AltRowColor1"; } } #end FOREACH } else { print<$Header
TOP } #end TopHTML sr sub BottomHTML { print<
$CopyrightWording
Ultimate
Guestbook, Version 1.0
� Madrona Park, Inc., 1999.
Bottom } # end BottomHTML sr sub GetDateTime { if ($TimeZoneOffset) { if (($TimeZoneOffset ne "") || ($TimeZoneOffset ne "0")) { $adjustTime = time() + ($TimeZoneOffset * 3600); } else { $adjustTime = time(); } ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime ($adjustTime); } else { ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time); } $mon++; $year = $year + 1900; $monformat = sprintf ("%2d", $mon); $monformat =~tr/ /0/; $mdayformat = sprintf ("%2d", $mday); $mdayformat =~tr/ /0/; @months = ("blank" , "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); #date format options $USDate = "$monformat-$mdayformat-$year"; $EuroDate = "$mdayformat-$monformat-$year"; $USDateExpanded = "$months[$mon] $mday, $year"; $EuroDateExpanded = "$mday $months[$mon] $year"; #time format options $min = sprintf ("%2d", $min); $min =~tr/ /0/; $hour = sprintf ("%2d", $hour); $hour =~tr/ /0/; $EuroTime = "$hour:$min"; &NormalTime; #convert to US time $USTime = "$USHour:$min $AMPM"; } #end GetDateTime sr sub NormalTime { if ($hour <12) { $AMPM="AM" ; $USHour="$hour" ; } if ($hour> 12) { $USHour = $hour - 12; $AMPM = "PM"; } if ($hour == 12) { $AMPM = "PM"; $USHour = "12"; } if ($hour == 0) { $USHour = "12"; } $UHhour = sprintf ("%2d", $USHour); $USHour =~tr/ /0/; }