$title$TXT_disallowed_word ~;
exit;
}
# end check bad words
# check for blocked IP
if ($ipoops eq "yes")
{
&basic_header;
print qq~
$title$TXT_blocked_IP ~;
exit;
}
# end check for blocked IP
if ($action eq "preview")
{
&preview;
}
&get_file_lock("$location_of_lock_file");
open(NUMBER,"$counter_name") || &oops('$counter_name');
$num = ;
close(NUMBER);
$plus = $num+1;
open (NUMBER,">$counter_name");
print NUMBER "$plus";
close(NUMBER);
open(DATABASE,">>$guestbook_data_name");
if ($moderated eq "yes")
{
print DATABASE "$plus|$full_name|$message|$mydate|$guest_email|$location||$ENV{'REMOTE_ADDR'}|$now|$revdate||$url||||waiting||||||||||||||||\n";
}
else
{
print DATABASE "$plus|$full_name|$message|$mydate|$guest_email|$location||$ENV{'REMOTE_ADDR'}|$now|$revdate||$url||||||||||||||||||||\n";
}
close(DATABASE);
&backup_to_dir;
&release_file_lock("$location_of_lock_file");
if ($send_email_to_admin eq "on")
{
unless (-e $mail_path)
{
&content;
print qq~ The path to the mail path which you have given as - $mail_path - in the Control Panel does not seem to exist.
Please check and change.
In the short term you can turn off the email options and the program will run okay. ~;
exit;
}
open (MAIL, "|$mail_path $admin_email");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Guestbook message\n\n";
if ($moderated eq "yes")
{
print MAIL "You have a new message in your guestbook which requires your approval. You can approve this message in the Message Manager section of the Active Guestbook Control Panel.\n\n";
}
else
{
print MAIL "You have a new message in your guestbook\n\n";
}
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "From: $full_name\n";
if ($guest_email) {
print MAIL "Email: $guest_email\n";
}
if ($location) {
print MAIL "Location: $location\n";
}
if ($url) {
print MAIL "URL: $url\n";
}
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
close(MAIL);
}
if (($guest_email) && ($send_email_to_guest eq "on") && ($moderated ne "yes"))
{
open (MAIL, "|$mail_path $guest_email");
print MAIL "To: $guest_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $thanks_title\n\n";
print MAIL "$thank_you\n\n";
if ($thanks_include_message eq "on")
{
$converted_message = $message;
$converted_message =~ s/ /\n/g;
print MAIL "=========================\n";
print MAIL "Your message:\n\n";
print MAIL "$converted_message\n\n";
print MAIL "=========================\n";
}
close(MAIL);
}
&thanks;
}
sub convert
{
}
sub add
{
&end if ($ipoops eq "yes");
&content;
&main_header;
&active_header if $active_header eq "on";
print qq~
~;
&user_html_footer if $use_user_html_footer eq "yes";
print qq~
~;
print "\n\n";
} # end sub add
########## startup
sub startup
{
unless (-e "$guestbook_backups_directory")
{
mkdir ($guestbook_backups_directory, 0777);
chmod(0777, "$guestbook_backups_directory");
open(BAK,">./$guestbook_backups_directory/undo_restore.bak");
close(BAK);
}
unless (-e "$guestbook_files_directory")
{
mkdir ($guestbook_files_directory, 0777);
chmod(0777, "$guestbook_files_directory");
}
########## months
unless (-e "$months_name")
{
open(MONTHS,">$months_name");
chmod(0777, "$months_name");
print MONTHS "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n";
close(MONTHS);
}
unless (-e "$months_bak_name")
{
open(MONTHS,">$months_bak_name");
chmod(0777, "$months_bak_name");
print MONTHS "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n";
close(MONTHS);
}
############ added for version 1.9 # create user and factory style defaults and style
unless (-e "$user_style_name")
{
open(STYLE,">$user_style_name");
chmod(0777, "$user_style_name");
print STYLE " \n";
print STYLE "\n";
close(STYLE);
}
####################
unless (-e "$senddate_name")
{
open(UPDATE1,">$senddate_name");
chmod(0777, "$senddate_name");
print UPDATE1 "$now";
close(UPDATE1);
}
unless (-e "$ip_name")
{
open(UPDATE3,">$ip_name");
chmod(0777, "$ip_name");
print UPDATE3 "$revdate";
close(UPDATE3);
}
unless (-e "$update_name")
{
open(UPDATE,">$update_name");
chmod(0777, "$update_name");
print UPDATE "$revdate";
close(UPDATE);
}
unless (-e "$user_html_name")
{
open(USER_HTML,">$user_html_name");
chmod(0777, "$user_html_name");
print USER_HTML "You can type some html here which will appear just above the menu. ";
close(USER_HTML);
}
unless (-e "$user_html_footer_name")
{
open(USER_HTML,">$user_html_footer_name");
chmod(0777, "$user_html_footer_name");
print USER_HTML "You can type some html here which will appear at the bottom of your page.";
close(USER_HTML);
}
unless (-e "$user_default_html_name")
{
open(USER_DEFAULT_HTML,">$user_default_html_name");
chmod(0777, "$user_default_html_name");
print USER_DEFAULT_HTML "You can type some html here which will appear just above the menu. ";
close(USER_DEFAULT_HTML);
}
unless (-e "$user_default_html_footer_name")
{
open(USER_DEFAULT_HTML,">$user_default_html_footer_name");
chmod(0777, "$user_default_html_footer_name");
print USER_DEFAULT_HTML "You can type some html here which will appear at the bottom of your page.";
close(USER_DEFAULT_HTML);
}
unless (-e "$thank_you_name")
{
open(THANKS,">$thank_you_name");
chmod(0777, "$thank_you_name");
print THANKS "Thank you very much for adding a message to our guestbook. Your support is much appreciated.\n\n";
print THANKS "Regards\n";
print THANKS "All at active-scripts.net\n\n";
print THANKS "=================================\n";
close(THANKS);
}
unless (-e "$thank_you_user_default_name")
{
open(THANKS,">$thank_you_user_default_name");
chmod(0777, "$thank_you_user_default_name");
print THANKS "Thank you very much for adding a message to our guestbook. Your support is much appreciated.\n\n";
print THANKS "Regards\n";
print THANKS "All at active-scripts.net\n\n";
print THANKS "=================================\n";
close(THANKS);
}
unless (-e "$tempcolprefs_name")
{
open(COLFILE,">$tempcolprefs_name");
chmod(0777, "$tempcolprefs_name");
print COLFILE "\n";
close(COLFILE);
}
unless (-e "$counter_name")
{
open(COUNTER,">>$counter_name");
chmod(0777, "$counter_name");
print COUNTER "1000100";
close(COUNTER);
chmod(0777, "$counter_name");
}
unless (-e "$active_name")
{
if (&GetCookies('activea'))
{
$coolkiepass = $Cookies{'activea'};
open(ACTIVE,">>$active_name");
chmod(0777, "$active_name");
print ACTIVE "$coolkiepass";
close(ACTIVE);
}
else
{
open(ACTIVE,">>$active_name");
chmod(0777, "$active_name");
print ACTIVE "$enc";
close(ACTIVE);
}
}
############# # language prefs added version 1.9
unless (-e "$langprefs_name")
{
open(PREFS,">>$langprefs_name");
chmod(0777, "$langprefs_name");
print PREFS "TXT_add_a_message=Add a message=\n";
print PREFS "TXT_search=Search=\n";
print PREFS "TXT_previous=<<<=\n";
print PREFS "TXT_next=>>>=\n";
print PREFS "TXT_there_is_now=There is now =\n";
print PREFS "TXT_there_are_now=There are now =\n";
print PREFS "TXT_messages_in_our_guestbook= messages in our guestbook.=\n";
print PREFS "TXT_message_in_our_guestbook= message in our guestbook.=\n";
print PREFS "TXT_viewing_message=Viewing message =\n";
print PREFS "TXT_viewing_messages=Viewing messages =\n";
print PREFS "TXT_to= to =\n";
print PREFS "TXT_after_last_number=.=\n";
print PREFS "TXT_after_last_number1=.=\n";
print PREFS "TXT_you_can_search_this_guestbook_by=You can search this guestbook by:=\n";
print PREFS "TXT_searchmessage=Message :=\n";
print PREFS "TXT_searchname=Name :=\n";
print PREFS "TXT_searchall=All :=\n";
print PREFS "TXT_searchsearch=Search=\n";
print PREFS "TXT_searchtext=Please type some text:=\n";
print PREFS "TXT_back_to_guestbook=Back to guestbook=\n";
print PREFS "TXT_your_name=Your name=\n";
print PREFS "TXT_your_message=Your message=\n";
print PREFS "TXT_required=(required)=\n";
print PREFS "TXT_where_in_the_world=Where in the world?=\n";
print PREFS "TXT_your_email_address=Your email address=\n";
print PREFS "TXT_your_web_page_address=Your web page address=\n";
print PREFS "TXT_if_you_have_one=(if you have one)=\n";
print PREFS "TXT_continue=Continue=\n";
print PREFS "TXT_these_are_the=These are the details you have given.=\n";
print PREFS "TXT_if_correct=If they are correct, please click Continue.=\n";
print PREFS "TXT_if_not=If not, please =\n";
print PREFS "TXT_go_back=go back =\n";
print PREFS "TXT_and_edit=and edit.=\n";
print PREFS "TXT_none_given=None given=\n";
print PREFS "TXT_has_been_added=Thanks. Your message has been added to our guestbook.=\n";
print PREFS "TXT_has_been_added_moderated=Thanks. Your message has been sent to our webmaster and will be added shortly.=\n";
print PREFS "TXT_search_results=Search results=\n";
print PREFS "TXT_back_search_again=Back to Guestbook/Search again=\n";
print PREFS "TXT_one_match=One guestbook message matches your search criteria.=\n";
print PREFS "TXT_no_match=Sorry, no messages in our guestbook match your search criteria.=\n";
print PREFS "TXT_more_matches_1=There are =\n";
print PREFS "TXT_more_matches_2= guestbook messages that match your search criteria.=\n";
print PREFS "TXT_please_fill_in=Please fill in all required fields.=\n";
print PREFS "TXT_please_go_back_and_edit=Please go back and edit=\n";
print PREFS "TXT_no_dot_at_start=Email addresses don't start with dots or @ signs.=\n";
print PREFS "TXT_no_www_at_start=Email addresses don't start with www. That's a web page address.=\n";
print PREFS "TXT_no_squiggles_in_domain=There should not be any underlines or squiggles or hashes after the @ in your email address.=\n";
print PREFS "TXT_only_one_at=There should be one (and only one) @ in your email address.=\n";
print PREFS "TXT_no_dots_next=You are not allowed to have dots next to each other or next to @ sign in your email address.=\n";
print PREFS "TXT_wrong_end=All email addresses end in a dot and some letters (such as .com, .net, .uk, .ac etc.).=\n";
print PREFS "TXT_too_many_words=Your message is too long. Please go back and edit.=\n";
print PREFS "TXT_disallowed_word=Your message contains a disallowed word. Please go back and edit.=\n";
print PREFS "TXT_blocked_IP=This service is currently unavailable.=\n";
close(PREFS);
}
######## create and write FACTORY DEFAULT $langprefs_backup_name
unless (-e "$langprefs_backup_name")
{
open(FILE,"$langprefs_name");
@lines = ;
close(FILE);
open(BAK,">$langprefs_backup_name");
chmod(0777, "$langprefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
###############
unless (-e "$prefs_name")
{
open(PREFS,">>$prefs_name");
chmod(0777, "$prefs_name");
print PREFS "textfontface=Arial=\n";
print PREFS "textfontsize=2=\n";
print PREFS "alignment=center=\n";
print PREFS "title=Active Guestbook=\n";
print PREFS "show_line=yes=\n";
print PREFS "home_page=http://active-scripts.net/=\n";
print PREFS "show_home_page_link=yes=\n";
print PREFS "home_page_target=_top=\n";
print PREFS "home_page_title=Active Scripts=\n";
print PREFS "order=reversed=\n";
print PREFS "border_size=0=\n";
print PREFS "mail_path=/usr/lib/sendmail=\n";
print PREFS "admin_email=webmaster\@active-scripts.net=\n";
print PREFS "send_email_to_admin=off=\n";
print PREFS "send_email_to_guest=off=\n";
print PREFS "thanks_title=Active Scripts Guestbook=\n";
print PREFS "thanks_include_message=off=\n";
print PREFS "anti_ips=111.111.111.3,server.isp.com=\n";
print PREFS "bad_words=wankle,rotary,engine=\n";
print PREFS "no_displayed=5=\n";
print PREFS "max_length=400=\n";
print PREFS "max_length_chars=4000=\n";
print PREFS "use_hr_image=no=\n";
print PREFS "hr_image=http://www.active-scripts.net/line.gif=\n";
print PREFS "max=3000=\n";
print PREFS "days_to_delete=1000=\n";
print PREFS "days_to_trash=365=\n";
print PREFS "days_to_delete_backup_files=60=\n";
print PREFS "mail_backup_to_admin=no=\n";
print PREFS "mail_admin_backups_interval=monthly=\n";
print PREFS "mail_admin_backups_day=1=\n";
print PREFS "mail_admin_backups_month=1=\n";
print PREFS "anti_spam=off=\n";
print PREFS "allow_html=no=\n";
print PREFS "active_header=on=\n";
print PREFS "use_title=off=\n";
print PREFS "show_no_of_messages=yes=\n";
print PREFS "mung=off=\n";
print PREFS "use_mailto=yes=\n";
print PREFS "web_enabled=yes=\n";
print PREFS "user_image=no=\n";
print PREFS "user_image_url==\n";
print PREFS "use_user_html=no=\n";
print PREFS "use_user_html_footer=no=\n";
print PREFS "table_width=600=\n";
print PREFS "usebackgroundimage=no=\n";
print PREFS "backgroundimage=http://active-scripts.net/active_guestbook/background.jpg=\n";
print PREFS "table_width=600=\n";
print PREFS "web_comment=Webmaster comments=\n";
print PREFS "style=on=\n";
print PREFS "moderated=no=\n";
print PREFS "field_length=40=\n";
print PREFS "left_bracket==\n";
print PREFS "middle_bracket=:=\n";
print PREFS "right_bracket==\n";
close(PREFS);
}
######## create and write FACTORY DEFAULT $prefs_backup_name
unless (-e "$prefs_backup_name")
{
open(FILE,"$prefs_name");
@lines = ;
close(FILE);
open(BAK,">$prefs_backup_name");
chmod(0777, "$prefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
######## create and write USER DEFAULT $prefs_backup_name
unless (-e "$userprefs_backup_name")
{
open(USERDEFAULT,">$userprefs_backup_name");
chmod(0777, "$userprefs_backup_name");
foreach $line (@lines)
{
print USERDEFAULT "$line";
}
close(USERDEFAULT);
}
######## create and write COLOR preferences
unless (-e "$colprefs_name")
{
open(COLPREFS,">>$colprefs_name");
chmod(0777, "$colprefs_name");
print COLPREFS "trans_search=no=\n";
print COLPREFS "trans_message_header=no=\n";
print COLPREFS "trans_message_body=no=\n";
print COLPREFS "backcolor=#ffffff=\n";
print COLPREFS "data_color1=#66cc99=\n";
print COLPREFS "data_color2=#cc9900=\n";
print COLPREFS "textdata_color1=#000000=\n";
print COLPREFS "textdata_color2=#000000=\n";
print COLPREFS "table_color1=#fffff0=\n";
print COLPREFS "table_color2=#ffffd0=\n";
print COLPREFS "texttable_color1=#000000=\n";
print COLPREFS "texttable_color2=#000000=\n";
print COLPREFS "backcolor=#ffffff=\n";
print COLPREFS "link=#000000=\n";
print COLPREFS "vlink=#000000=\n";
print COLPREFS "alink=#000000=\n";
print COLPREFS "text=#000000=\n";
# print COLPREFS "commentcolor=#ff0000=\n";
print COLPREFS "searchcolor=#eeeeee=\n";
close(COLPREFS);
}
######## create and write FACTORY DEFAULT COLOR preferences
unless (-e "$colprefs_backup_name")
{
open(FILE,"$colprefs_name");
@lines = ;
close(FILE);
open(BAK,">$colprefs_backup_name");
chmod(0777, "$colprefs_backup_name");
foreach $line (@lines)
{
print BAK "$line";
}
close(BAK);
}
######## create and write USER DEFAULT COLOR preferences
unless (-e "$usercolprefs_backup_name")
{
open(USERDEFAULT,">$usercolprefs_backup_name");
chmod(0777, "$usercolprefs_backup_name");
foreach $line (@lines)
{
print USERDEFAULT "$line";
}
close(USERDEFAULT);
}
unless (-e "$guestbook_data_name")
{
chmod(0777, "$prefs_name");
chmod(0777, "$colprefs_name");
&open_prefs;
umask 000;
open(TEMP,">>$guestbook_data_name");
print TEMP "1000001|Sample user|Great guestbook.|$mydate||Uganda|||$now|$revdate||||||||||||||||||||||\n";
for ($w=2;$w<10;$w++)
{
print TEMP "100000$w|Sample user $w|Sample message $w.|$mydate||Uganda|||$now|$revdate||||||||||||||||||||||\n";
}
print TEMP "1000030|Active Scripts |Well done. You have successfully installed Active Guestbook.
";
print TEMP "Once you have browsed the features in the public part of the guestbook, you will want to access the Active Guestbook Control Panel which allows you to manage your guestbook. To access the Control Panel, you will normally need to use a password. The default password is the word active in lower case but you can change it to anything you like.";
print TEMP "
The first thing you should do once you visit the Control Panel is to add the page to your Bookmarks/Favorites so that you can easily get there in the future.
You can now go to the Control Panel by clicking here.
";
print TEMP "You will of course want to delete all these sample messages once you get things set up the way you want.|$mydate|anthony\@active-scripts.net|active-scripts.net|||$now|$revdate||www.active-scripts.net||||||||||||||||||||\n";
close(TEMP);
chmod(0777, "$guestbook_data_name");
&finish_start;
exit;
}
} # end startup
sub finish_start
{
&content;
print qq~
To remove the Active Scripts image from the top of your guestbook, move down to the
Images/titles section below and select No for "Show Active-Scripts header".
~;
}
print qq~
~;
}
sub show_number_menu
{
print qq~
$left_bracket
~;
$number_of_messages = int($number_of_messages); # int here sorts out any funny decimals entered in the control panel
$number_of_pages = ($number_of_messages / $no_displayed) ;
$number_of_pages = int($number_of_pages); # no of full pages
if ($number_of_messages > ($number_of_pages * $no_displayed))
{
$extra = "yes";
}
if ($extra eq "yes")
{
$number_of_pages = $number_of_pages +1;
}
($start_number = 0) if (!$start_number);
for ($x = 1; $x < $number_of_pages+1 ; $x++ )
{
$sn = (($x*$no_displayed)- $no_displayed);
$bottom = ($start_number - (11 * $no_displayed));
$top = ($start_number + (11 * $no_displayed));
if ((($sn > $bottom) && ($sn < $top)) || ($x == "1") || ($x == $number_of_pages))
{
if ($sn ne $start_number)
{
print qq~
$x
~;
}
else
{
print qq~
$x
~;
} # end else
}
} # end for
print qq~
$right_bracket
~;
}
sub user_image
{
if ($user_image_url)
{
print qq~
~;
}
else
{
print qq~
You have not given an image file address in the Standard Preferences Manager.
Either select NO for 'Use your own image at top of guestbook' in the Standard
Preferences Manager, or fill in the address of your image in the 'Address of your
image' field in the Standard Preferences Manager.
~;
}
}
sub user_html
{
print qq~ $user_html ~;
}
sub user_html_footer
{
print qq~ $user_html_footer ~;
}
sub view_change_password
{
&seek_cook;
&content;
print qq~
$title
~;
&required_script;
print qq~
~;
print qq~
Password Manager Control Panel Please enter your new password twice. (please note that passwords are case-sensitive)
~;
&inter_footer;
}
sub change_password
{
&seek_cook;
$pass1 = $FORM{'requiredpass1'};
$passcheck = $FORM{'requiredpasscheck'};
if ($pass1 eq $passcheck)
{
open(ACTIVE,">$active_name");
$newpass = crypt($pass1, $salt);
print ACTIVE "$newpass";
close(ACTIVE);
&SetCookies('activea',$newpass);
&content;
&main_headera;
print qq~ ~;
&main_headerb;
print qq~
Change Active Guestbook Control Panel Password Password has been changed.
~;
}
else
{
&content;
&plain_header_stop;
print qq~
Change Active Guestbook Control Panel Password
The password has NOT been changed. The two passwords you typed were not the same.
Control Panel | Try again
~;
}
}
sub enter_password
{
&content;
print qq~
$title
~;
print qq~
Factory default language preferences restored.
~;
&inter_footer;
}
sub check_new_files
{
unless (-e "$counter_name")
{
&content;
print "The file $counter_name does not exist" ;
exit;
}
unless (-e "$guestbook_data_name")
{
&content;
print "The file $guestbook_data_name does not exist" ;
exit;
}
unless (-e "$prefs_name")
{
&content;
print "The file $prefs_name does not exist" ;
exit;
}
unless (-r "$counter_name")
{
&content;
print "The file $counter_name does can not be read." ;
exit;
}
unless (-r "$guestbook_data_name")
{
&content;
print "The file guestbook_data can not be read." ;
exit;
}
unless (-r "$prefs_name")
{
&content;
print "The file $prefs_name can not be read." ;
exit;
}
unless (-w "$counter_name")
{
&content;
print "The file $counter_name can not be written to." ;
exit;
}
unless (-w "