The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Guestbook Not Working
colleen_stg
post Jan 16 2008, 10:14 PM
Post #1





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



I'm putting together a wedding web site for my sister. The site is already live due to a short time line. And the last "piece of the puzzle" is getting the guestbook functioning. I don't know a lot about coding (I've used free templates and free scripts to create the site), I'm more a graphic designer.

Having said that, I used the free guestbook script provided here:
http://www.scriptarchive.com/guestbook.html

I followed the steps, made sure the permission (CHMOD) settings were correct, and have checked with my domain provider (even upgraded to be sure Perl script was allowed) and it's still not working. The only thing I've done differently from the instructions given with the guestbook script was to place the add guestbook form on the same page as the preview of all the previous posts. Basically, I want the Submit Form on the left and - on the right - a scrolling preview of all the posts to date. Don't know if that would make a difference but I thought it was worth mentioning.

The page is stgeorgelewis.com/guestbook.html
Please, please, please - any help would be really appreciated!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Jan 17 2008, 12:02 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



The guestbook script at http://www.stgeorgelewis.com/cgi-bin/guestbook.pl gives a "Server error", which means that the script is probably there, but is not working. You need to show the content of the script page (removing email addresses, for example). If the answer isn't obvious, you will need a perl expert.

"Matt's scripts" by the way are notoriously insecure and not recpmmended. A "naked" guestbook like this may very quickly get inundated with spam; you need to use (e.g.) a "captcha" image of code letters to check you have a human.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 17 2008, 12:33 AM
Post #3


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



QUOTE(Brian Chandler @ Jan 16 2008, 09:02 PM) *

"Matt's scripts" by the way are notoriously insecure and not recpmmended. A "naked" guestbook like this may very quickly get inundated with spam; you need to use (e.g.) a "captcha" image of code letters to check you have a human.


There is an "improved" version of some of "Matt's scripts", including formtomail at MNS Project. It may be worthwhile to check it out. I know that the NMS version of the formtomail is far secure than that of "Matt's scripts". But I know nothing about the guestbook.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
colleen_stg
post Jan 18 2008, 04:59 PM
Post #4





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



Thanks for the help.

Here's the content of the script page. I removed the "Matt's Script" header to make the post a little shorter:
CODE

#!/usr/bin/perl
# Set Variables

$guestbookurl = "http://www.stgeorgelewis.com/guestbook.html";
$guestbookreal = "/home/guestbook.html";
$guestlog = "/home/guestlog.html";
$cgiurl = "http://www.stgeorgelewis.com/cgi-bin/guestbook.pl";
$date_command = "/usr/bin/date";

# Set Your Options:
$mail = 0; # 1 = Yes; 0 = No
$uselog = 1; # 1 = Yes; 0 = No
$linkmail = 0; # 1 = Yes; 0 = No
$separator = 1; # 1 = <hr>; 0 = <p>
$redirection = 0; # 1 = Yes; 0 = No
$entry_order = 1; # 1 = Newest entries added first;
# 0 = Newest Entries added last.
$remote_mail = 0; # 1 = Yes; 0 = No
$allow_html = 1; # 1 = Yes; 0 = No
$line_breaks = 1; # 1 = Yes; 0 = No

# If you answered 1 to $mail or $remote_mail you will need to fill out
# these variables below:
$mailprog = '/usr/sbin/sendmail';
$recipient = 'info@stgeorgelewis.com';

# Done
##############################################################################

# Get the Date for Entry
$date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
$shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);

# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;

if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}

$FORM{$name} = $value;
}

# Print the Blank Response Subroutines
&no_comments unless $FORM{'comments'};
&no_name unless $FORM{'realname'};

# Begin the Editing of the Guestbook File
open (FILE,"$guestbookreal") || die "Can't Open $guestbookreal: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;

# Open Link File to Output
open (GUEST,">$guestbookreal") || die "Can't Open $guestbookreal: $!\n";

for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--begin-->/) {

if ($entry_order eq '1') {
print GUEST "<!--begin-->\n";
}

if ($line_breaks == 1) {
$FORM{'comments'} =~ s/\cM\n/<br>\n/g;
}

print GUEST "<b>$FORM{'comments'}</b><br>\n";

if ($FORM{'url'}) {
print GUEST "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
}
else {
print GUEST "$FORM{'realname'}";
}

if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print GUEST " \&lt;<a href=\"mailto:$FORM{'username'}\">";
print GUEST "$FORM{'username'}</a>\&gt;";
}
else {
print GUEST " &lt;$FORM{'username'}&gt;";
}
}

print GUEST "<br>\n";

if ( $FORM{'city'} ){
print GUEST "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print GUEST " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print GUEST " $FORM{'country'}";
}

if ($separator eq '1') {
print GUEST " - $date<hr>\n\n";
}
else {
print GUEST " - $date<p>\n\n";
}

if ($entry_order eq '0') {
print GUEST "<!--begin-->\n";
}

}
else {
print GUEST $_;
}
}

close (GUEST);

# Log The Entry

if ($uselog eq '1') {
&log('entry');
}


#########
# Options

# Mail Option
if ($mail eq '1') {
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";

print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "From: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "Subject: Entry to Guestbook\n\n";
print MAIL "You have a new entry in your guestbook:\n\n";
print MAIL "------------------------------------------------------\n";
print MAIL "$FORM{'comments'}\n";
print MAIL "$FORM{'realname'}";

if ( $FORM{'username'} ){
print MAIL " <$FORM{'username'}>";
}

print MAIL "\n";

if ( $FORM{'city'} ){
print MAIL "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print MAIL " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print MAIL " $FORM{'country'}";
}

print MAIL " - $date\n";
print MAIL "------------------------------------------------------\n";

close (MAIL);
}

if ($remote_mail eq '1' && $FORM{'username'}) {
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";

print MAIL "To: $FORM{'username'}\n";
print MAIL "From: $recipient\n";
print MAIL "Subject: Entry to Guestbook\n\n";
print MAIL "Thank you for adding to my guestbook.\n\n";
print MAIL "------------------------------------------------------\n";
print MAIL "$FORM{'comments'}\n";
print MAIL "$FORM{'realname'}";

if ( $FORM{'username'} ){
print MAIL " <$FORM{'username'}>";
}

print MAIL "\n";

if ( $FORM{'city'} ){
print MAIL "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print MAIL " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print MAIL " $FORM{'country'}";
}

print MAIL " - $date\n";
print MAIL "------------------------------------------------------\n";

close (MAIL);
}

# Print Out Initial Output Location Heading
if ($redirection eq '1') {
print "Location: $guestbookurl\n\n";
}
else {
&no_redirection;
}

#######################
# Subroutines

sub no_comments {
print "Content-type: text/html\n\n";
print "<html><head><title>No Comments</title></head>\n";
print "<body><h1>Your Comments appear to be blank</h1>\n";
print "The comment section in the guestbook fillout form appears\n";
print "to be blank and therefore the Guestbook Addition was not\n";
print "added. Please enter your comments below.<p>\n";
print "<form method=POST action=\"$cgiurl\">\n";
print "Your Name:<input type=text name=\"realname\" size=30 ";
print "value=\"$FORM{'realname'}\"><br>\n";
print "E-Mail: <input type=text name=\"username\"";
print "value=\"$FORM{'username'}\" size=40><br>\n";
print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
print "size=15>, State: <input type=text name=\"state\" ";
print "value=\"$FORM{'state'}\" size=15> Country: <input type=text ";
print "name=\"country\" value=\"$FORM{'country'}\" size=15><p>\n";
print "Comments:<br>\n";
print "<textarea name=\"comments\" COLS=60 ROWS=4></textarea><p>\n";
print "<input type=submit> * <input type=reset></form><hr>\n";
print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
print "\n</body></html>\n";

# Log The Error
if ($uselog eq '1') {
&log('no_comments');
}

exit;
}

sub no_name {
print "Content-type: text/html\n\n";
print "<html><head><title>No Name</title></head>\n";
print "<body><h1>Your Name appears to be blank</h1>\n";
print "The Name Section in the guestbook fillout form appears to\n";
print "be blank and therefore your entry to the guestbook was not\n";
print "added. Please add your name in the blank below.<p>\n";
print "<form method=POST action=\"$cgiurl\">\n";
print "Your Name:<input type=text name=\"realname\" size=30><br>\n";
print "E-Mail: <input type=text name=\"username\"";
print " value=\"$FORM{'username'}\" size=40><br>\n";
print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
print "size=15>, State: <input type=text name=\"state\" ";
print "value=\"$FORM{'state'}\" size=2> Country: <input type=text ";
print "value=USA name=\"country\" value=\"$FORM{'country'}\" ";
print "size=15><p>\n";
print "Comments have been retained.<p>\n";
print "<input type=hidden name=\"comments\" ";
print "value=\"$FORM{'comments'}\">\n";
print "<input type=submit> * <input type=reset><hr>\n";
print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
print "\n</body></html>\n";

# Log The Error
if ($uselog eq '1') {
&log('no_name');
}

exit;
}

# Log the Entry or Error
sub log {
$log_type = $_[0];
open (LOG, ">>$guestlog");
if ($log_type eq 'entry') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate]<br>\n";
}
elsif ($log_type eq 'no_name') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No Name<br>\n";
}
elsif ($log_type eq 'no_comments') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No ";
print LOG "Comments<br>\n";
}
}

# Redirection Option
sub no_redirection {

# Print Beginning of HTML
print "Content-Type: text/html\n\n";
print "<html><head><title>Thank You</title></head>\n";
print "<body><h1>Thank You For Signing The Guestbook</h1>\n";

# Print Response
print "Thank you for filling in the guestbook. Your entry has\n";
print "been added to the guestbook.<hr>\n";
print "Here is what you submitted:<p>\n";
print "<b>$FORM{'comments'}</b><br>\n";

if ($FORM{'url'}) {
print "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
}
else {
print "$FORM{'realname'}";
}

if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print " &lt;<a href=\"mailto:$FORM{'username'}\">";
print "$FORM{'username'}</a>&gt;";
}
else {
print " &lt;$FORM{'username'}&gt;";
}
}

print "<br>\n";

if ( $FORM{'city'} ){
print "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print " $FORM{'country'}";
}

print " - $date<p>\n";

# Print End of HTML
print "<hr>\n";
print "<a href=\"$guestbookurl\">Back to the Guestbook</a>\n"; print "- You may need to reload it when you get there to see your\n";
print "entry.\n";
print "</body></html>\n";

exit;
}
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Jan 18 2008, 06:37 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



The problem with "Matt's scripts" isn't the header. It's the code.

Anyway, what happens when you try to run the script from the command line?

Alternatively, what shows up in the server error logs when you try to access the script's URL?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 18 2008, 07:21 PM
Post #6


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



I whole heartedly agree with Darin's comments. Having said that let me throw in a twist.....

This is what I would do if I was in your situation:
I would bite the bullet and put aside the script from "Matt's Archives" and start from square one by downloading the MNS script. After reading carefully all pertinent info on that site, as well as any info available in the download package. Then start implementing it on your site.

Please note that I have not used the Guest-book script before. However I used the MNS form-to-mail script. I found the info & instructions rather basic, but very easy to follow and implement.

Good Luck!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
colleen_stg
post Jan 18 2008, 07:52 PM
Post #7





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



Thanks so much for the help and quick response. I think I'll try and scrap what I've got and start from scratch with the MNS script.

Can't make chicken salad out of ...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
colleen_stg
post Jan 19 2008, 12:47 PM
Post #8





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



I started from scratch using the NMS script. I followed the customization instructions and am still getting the Error 500. My domain provider has a CGI output checker to find the source of the error. I ran it through that until I received a "succeeded" message. And it STILL does not work.

Is anyone willing (or do you know anyone willing) to fix the problem for payment?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
EnzyBoi
post Jan 19 2008, 01:32 PM
Post #9





Group: Members
Posts: 9
Joined: 19-January 08
From: New Zealand
Member No.: 4,749



I was too lazy to ever sort my own guestbook out, but I think I may give it a shot with my latest project.

http://www.a-free-guestbook.com/ used to get a bit of a workout from me. tongue.gif

Good luck on your venture. smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 19 2008, 06:05 PM
Post #10


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



QUOTE(colleen_stg @ Jan 19 2008, 09:47 AM) *

I started from scratch using the NMS script. I followed the customization instructions and am still getting the Error 500. My domain provider has a CGI output checker to find the source of the error. I ran it through that until I received a "succeeded" message. And it STILL does not work.

Is anyone willing (or do you know anyone willing) to fix the problem for payment?


What I have done with a new script like that, is a "minimal install" to begin with. What I mean with a "minimal install" is to install it in its very basic form, with no customization for your application. If you can make that work, then proceed to customize it - "step by step", for your needs/wants. The reason I say step-by-step is from years of experience.... It is much easier to trouble shoot a singular problem than a collection of them.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 19 2008, 07:51 PM
Post #11


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



Afterthought......
Did you upload the script using "ASCII" mode?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
colleen_stg
post Jan 19 2008, 08:05 PM
Post #12





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



I actually am using the "minimalist" approach. The only thing I changed in the NMS script are the paths and the 0 or 1 responses to turn certain function off/on.

Because my site is already live and getting visitors, there are no links to the NMS guestbook. It's at stgeorgelewis.com/NMSguestbook/guestbook.html for testing.

I'm uploading the files via Fetch (Mac) software. The Mode is set to automatic. The only other choices are Text or Binary - no ASCII. I do have a PC with Smart FTP that I can use to upload them - if you think it might solve the problem.

I just use the Mac b/c it's a laptop and I value the mobility.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 19 2008, 09:10 PM
Post #13


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



QUOTE(colleen_stg @ Jan 19 2008, 05:05 PM) *


I'm uploading the files via Fetch (Mac) software. The Mode is set to automatic. The only other choices are Text or Binary - no ASCII. I do have a PC with Smart FTP that I can use to upload them - if you think it might solve the problem.

OK, we may be unto something.... Try this:
Erase the script on the server
Upload the script once more in "Text" Mode

The Automatic setting for the mode works a great majority of the time, except when it comes to cgi-scripts.

Good luck.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Jan 19 2008, 09:41 PM
Post #14


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



I get
QUOTE
Bad Referrer - Access Denied

The form attempting to use this script resides at http://stgeorgelewis.com/NMSguestbook/addguest.html, which is not allowed to access this program.

If you are attempting to configure FormMail to run with this form, you need to add the following to @referers, explained in detail in the README file.

Add 'stgeorgelewis.com' to your @referers array.

FormMail © 2001-2003 London Perl Mongers
So, did you update the @referers array?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dr Z
post Jan 20 2008, 01:51 AM
Post #15


Advanced Member
****

Group: Members
Posts: 221
Joined: 23-August 06
Member No.: 11



Triggered by Darin's comments, another after-thought... Are you uploading the script to your cgi-bin, not to any directory in htdoc?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
colleen_stg
post Jan 20 2008, 01:39 PM
Post #16





Group: Members
Posts: 6
Joined: 16-January 08
Member No.: 4,725



Thanks everyone for the help I really appreciate it!

Dr Z - I deleted old files ad re-uploaded using Text mode. Set permissions and after shift+refresh same error 500 occurs when submitting add to guestbook form.

Darin - I don't think I'm using FormMail with the guestbook. At least I didn't see it mentioned anywhere in the Read Me for the guestbook script. Also, any time you had the option to use email (like to notify of new posts) I chose no. Specifically so I could try to isolate my problem. In the guestbook.pl I could not find any reference to @referers.

Dr Z - I am uploading to the cgi-bin folder on the FTP site.

I can take screenshots of file on the server and their permissions or copy and paste any parts of the code or script that you think might need to be looked at.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 04:02 AM