#!/usr/bin/perl # ### ADMIN SCRIPT FOR ULTIMATE GUESTBOOK ## # # Ultimate Guestbook is
copyright Madrona Park, Inc. # # User assumes all liability that # may result due to
installation problems and/or # content posted on your guestbook. User must also # keep all
copyright notices on applicable pages. # # For more info on the Ultimate Guest Book, # see
http://www.scriptkeeper.com # #For info on Madrona Park, Inc, see
http://www.madronapark.com
################################################################ 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"; }; if ($@) { print "Error including required files:
$@\n"; print "Make sure these files exist, permissions are set properly, and
paths are set correctly."; exit; } &ReadParse; $action = $in{'action'}; if
($action eq "edit") { &Edit; } if ($action eq "styles") {
&Styles; } if ($action eq "genvars") { &GenVars; } if ($action eq
"setgenvars") { &SetGenVars; } if ($action eq "enterstyles") {
&EnterStyles; } if ($action eq "enteredit") { &EnterEdit; } if ($action
eq "sendstyles") { &SendStyles; } if ($action eq "entergenvar") {
&EnterGenVar; } if ($action eq "env") { &Env; } if ($action eq
"mdelete") { &MDelete; } if ($action eq "deleteentry") {
&DeleteEntry; } sub DeleteEntry { &ValidatePW; @entries =
&OpenFile("$GB_NON_CGI_Path/entries.file"); foreach $uno(@entries) {
@thisline = split(/\|\|/, $uno); chomp($thisline[6]); unless ($thisline[6] eq
"$in{'number'}") { push(@revised, $uno); } } &Lock("lock.file");
open(REVISED, ">$GB_NON_CGI_Path/entries.file"); foreach $one(@revised) {
chomp($one); print REVISED "$one\n"; } close(REVISED);
&Unlock("lock.file"); #send onscreen confirmation print<
Thank you! We have deleted the guestbook entry you specified. You are now being taken back to the guestbook automatically. Please wait two seconds. |
ForwardHTML } sub MDelete { &StandardHTML("This feature is coming soon. You
can delete individual entries from the guestbook itself."); } sub EnterEdit {
&ValidatePW; $PageTitle = "Delete a Guestbook Entry"; &HEADERHTML; print<
ID Number:
Ultimate Guestbook, Version 1.0
� Madrona Park, Inc., 1999.
THIS } #end Enter Edit sub ValidatePW { if ($in{'setpw'} ne "true") {
&CheckPW; if ($check ne "true") { &StandardHTML("You did not enter
valid passwords. Please use your back button to try again."); exit; } } } sub
EnterGenVar { if ($CopyrightWording ne "") { $CopyrightWording =
&UnHTML($CopyrightWording); } if ($AddEntryInfo ne "") { $AddEntryInfo =
&UnHTML($AddEntryInfo); } if ($IntroText ne "") { $IntroText =
&UnHTML($IntroText); } if ($ConfirmAddWording ne "") { $ConfirmAddWording =
&UnHTML($ConfirmAddWording); } $Password1 = $in{'password1'}; $Password2 =
$in{'password2'}; &ValidatePW; if ($GB_CGI_Path eq "") { @cgipath =
split(/\//, $ENV{'SCRIPT_FILENAME'}); pop(@cgipath); $GB_CGI_Path = join("\/",
@cgipath); $VariablesPath = $GB_CGI_Path; } if ($GB_NON_CGI_Path eq "") {
$GB_NON_CGI_Path = "$ENV{'DOCUMENT_ROOT'}/uguestbook"; } if ($NonCGIURL eq
"") { $NonCGIURL = "http://$ENV{'HTTP_HOST'}/uguestbook"; $CGIURL =
"http://$ENV{'HTTP_HOST'}/cgi-bin"; $BBEmail = "$ENV{'SERVER_ADMIN'}";
} if ($Censor eq "ON") { $CensorON = "CHECKED"; } else { $CensorOFF =
"CHECKED"; } if ($TimeFormat eq "24HR") { $Time24HR =
"CHECKED"; } else { $TimeAMPM = "CHECKED"; } if ($DateFormat eq
"Euro") { $DateEuro = "CHECKED"; } elsif ($DateFormat eq
"EuroExpanded") { $DateEuroX = "CHECKED"; } elsif ($DateFormat eq
"USExpanded") { $DateUSX = "CHECKED"; } else { $DateUS =
"CHECKED"; } if ($Field2Hyper eq "Email") { $F2HyperEmail =
"CHECKED"; } elsif ($Field2Hyper eq "URL") { $F2HyperURL =
"CHECKED"; } else { $F2HyperNone = "CHECKED"; } if ($Field3Hyper eq
"Email") { $F3HyperEmail = "CHECKED"; } elsif ($Field3Hyper eq
"URL") { $F3HyperURL = "CHECKED"; } else { $F3HyperNone =
"CHECKED"; } if ($HTMLAllow eq "yes") { $HTMLyes =
"CHECKED"; } else { $HTMLno = "CHECKED"; } if ($UBBCodeAllow eq
"yes") { $UBBCodeyes = "CHECKED"; } else { $UBBCodeno =
"CHECKED"; } $PageTitle = "Set General Variables"; &HEADERHTML;
print<
THIS } # end EnterGenVar sr sub GenVars { $PageTitle = "Set General
Variables"; &HEADERHTML; #check to see if passwords have been set if (-e
"$GB_NON_CGI_Path/gbpassword.pl") { #if username and password have been set,
query for Passwords &AuthenticateWording("entergenvar"); } else { #if
passwords have not been set, query user to set them now &QueryToSetPW; } } ## END
genvars SR ## sub Env { print<
|
Your Environmental Variables |
Use these to help you figure out your absolute file paths, and other system information.
Your Perl Version: $]
TOP foreach $envline (%ENV) { print $envline; print "
\n"; } print<
BOTTOM } # END ENV SR sub HEADERHTML { print<
$PageTitle
HEADER } #end HEADERHTML sr sub SetGenVars { #make sure path is correct if (-e "$in{'GB_NON_CGI_Path'}/frown.gif") { if (-e "$in{'GB_NON_CGI_Path'}/gbpassword.pl") { &CheckPW; if ($check eq "true") { &SetVars; } else { &StandardHTML("Sorry, did not enter the correct passwords. We cannot process your variables until this is corrected. Use your back button to try again."); } } else { &SetPW; &SetVars; } } else { &StandardHTML("Sorry, but you do not seem to have entered the correct absolute path for your NON CGI directory. Your other absolute paths may also be incorrect. We cannot process your variables until this is corrected. Use your back button to try again."); } } ##END Set Gen Vars sub SetVars { if ($in{'Field1'} eq "") { $in{'Field1'} = "Name"; } if ($in{'Field4'} eq "") { $in{'Field4'} = "Guestbook Entry"; } if ($in{'Field1Size'} eq "") { $in{'Field1Size'} = "20"; } if ($in{'Field1MaxSize'} eq "") { $in{'Field1MaxSize'} = "40"; } open (FILE, ">$in{'VariablesPath'}/gb_variables.pl") or die("Unable to open setup file for writing."); foreach $one(@in) { ($Name, $Value) = split ("=", $one); $Name = &decodeURL($Name); $Value = &decodeURL($Value); $Value =~ s/\@/\\@/g; $Value =~ s/"/\\"/g; if (($Name eq "AddEntryInfo") || ($Name eq "IntroText") || ($Name eq "ConfirmAddWording")) { $Value = &ConvertReturns($Value); $Value =~ s/(
)+/
/ig; } else { $Value = &EliminateReturns($Value); } print FILE
("\$$Name = \"$Value\";\n"); } print FILE ("1;\n"); close
(FILE); chmod (0777, "$in{'VariablesPath'}/gb_variables.pl");
&StandardHTML("Thank you! Your general variables have been set! If you are
configuring your guestbook for the first time, don't forget to set your style variables as
well."); } #end Setvars sr sub SetPW { $Password1 = &decodeURL($in{'password1'});
$Password2 = &decodeURL($in{'password2'}); open (SETIT,
">$in{'GB_NON_CGI_Path'}/gbpassword.pl"); print SETIT
"$Password1\n"; print SETIT "$Password2"; close (SETIT); chmod (0666,
"$in{'GB_NON_CGI_Path'}/gbpassword.pl"); } #end SetPW sr sub CheckPW { if
(($in{'action'} eq "entergenvar") || ($in{'action'} eq "enterstyles")
|| ($in{'action'} eq "sendstyles") || ($in{'action'} eq
"deleteentry")){ $ThePath = "$GB_NON_CGI_Path"; } else { $ThePath =
"$in{'GB_NON_CGI_Path'}"; } open (READIT, "$ThePath/gbpassword.pl");
@pw =
If you don't remember your passwords, open the file entitled "gbpassword.pl" in your guestbook NON CGI directory. The two passwords are listed in that file.
NOTE: Guestbook Entry Number $in{'number'} will be deleted when you press the submit button below.
Threads } else { #if passwords have not been set, query user to set them
now &QueryToSetPW; } } ## END Edit SR ## sub AuthenticateWording { my $action = shift;
print<
If you don't remember your passwords, open the file entitled "gbpassword.pl" in your guestbook NON CGI directory. The two passwords are listed in that file.
Threads } sub QueryToSetPW { print<
To administer your guestbook, you need to set two passwords, which will be used whenever you want to access this control panel area. By using passwords, you can ensure that no one else can make changes to your guestbook but you (or others you give the passwords to).
You need to set two passwords. These passwords can be identical, but we recommend that you set two different words. These words should contain only letters or numbers. All passwords are case-sensitive. This means that if you enter a password of "Wally", "WALLY" will not match it.
Set your guestbook passwords below!
Ultimate Guestbook
� Madrona Park, Inc., 1999.
Threads } #end QueryToSetPW sub EnterStyles { &ValidatePW;
$PageTitle = "Set Style Variables"; &HEADERHTML; if ($CopyrightTextColor eq
"") { $CopyrightTextColor = "#C0C0C0"; } if ($TextSize eq
"") { $TextSize = "2"; } if ($FontFace eq "") { $FontFace =
"Verdana, Arial"; } if ($TextColor eq "") { $TextColor =
"#000000"; } if ($LinkColor eq "") { $LinkColor = "#000080";
} if ($VisitedLinkColor eq "") { $VisitedLinkColor = "#808000"; } if
($TableStripTextColor eq "") { $TableStripTextColor = "#000080"; } if
($GBTitlePic eq "") { $GBTitlePic = "ugb.jpg"; } if ($AddEntryPic eq
"") { $AddEntryPic = "addentry.jpg"; } if ($TableWidth eq
"") { $TableWidth = "95%"; } if ($PostedByColor eq "") {
$PostedByColor = "#800000"; } if ($BGColor eq "") { $BGColor =
"#FFFFFF"; } else { if ($BGColor =~ /=/) { ($junk, $BGColor) = split (/=/,
$BGColor); chomp($BGColor); } } if ($TableColorStrip eq "") { $TableColorStrip =
""; } else { if ($TableColorStrip =~ /=/) { ($junk, $TableColorStrip) = split
(/=/, $TableColorStrip); chomp($TableColorStrip); } } print<
Ultimate Guestbook
� Madrona Park, Inc., 1999.
Style12 } # end EnterStyles sr sub Colors { print<