#!/usr/bin/perl
print ("Content-type: text/html\n
");
eval {
(\$0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows /
(\$0 =~ m,(.*)\[^\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \n#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 {
&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 = ;
close (OLDENTRIES);
@backwards = reverse(@entries);
\$lastline = @backwards[0];
@laststats = split(/\||/, \$lastline);
\$LastNumber = $laststats[6];
chomp(\$LastNumber);
\$NextNumber = $LastNumber + 1;
} else {
\$NextNumber = 1;
}
open (ENTRIES, ">>\$GB_NON_CGI_Path/entries.file");
print ENTRIES "\$ThisDate||$ThisTime||$Field1Value||$Field2Value||$Field3Value||$Field4Value||$NextNumber\n";
close (ENTRIES);
chmod (0666, "\$GB_NON_CGI_Path/entries.file");
&TopHTML;
print<
يمكن استخدام كود الـ UBB);
} else {
\$UBBLine = qq( لا يمكن استخدام كود الـ UBB);
}
if (\$HTMLAllow eq "yes") {
\$HTMLLine = qq(يمكن استخدام كود الـ HTML);
} else {
\$HTMLLine = qq( لا يمكن استخدام كود الـ HTML);
}
print<
\$AddEntryIntro
\$UBBLine $HTMLLine
ENDTABLE
&BottomHTML;
} # end Add Entry sr
sub Summary {
&TopHTML;
print <<_TOP_OF_PAGE;