McDuff
03-15-2008, 05:06 PM
Our guestbook on czechfriends org is an adaptation of the standard FQ guestbook, with a private and public section. We got a heads-up it did not work, turned out to be a simple } in the wrong place (just before the } else { statement, Bob, :bow: thanks for pointing me in the right direction). Last time we tried it worked, but I was wondering why we did not get any messages. No idea how this corrupt version got there and how long :dunno:.
People have the option to only give private input, using it as a contact form to us. However, even if all public fields are empty, the script still prints the “new message” followed by empty space and the date.
foreach $line (@lines) {
if ($line =~ /<!--begin-->/) {
print GUEST ("<!--begin-->\n");
print GUEST ("<p>New message:</p>");
if ($INPUT{'pubcom'}) {
$INPUT{'comments'} =~ s/\cM\n/<br>\n/g;
$mailcomments = $INPUT{'comments'};
$mailcomments =~ s/<br>//g;
print GUEST ("<p>$INPUT{'pubcom'}</p><br>");
}
print GUEST ("<p>This message was posted by <b>$INPUT{'alias'}</b> on $date</p><hr>\n\n");
} else {
print GUEST ("$line");
}
Any simple script line I can add to the cgi file so that if the public fields are empty, the script does not print anything in the visitors book but still follows all the other commands?
If anybody is interested in how we adapted the script, be glad to share it, just let me know.
People have the option to only give private input, using it as a contact form to us. However, even if all public fields are empty, the script still prints the “new message” followed by empty space and the date.
foreach $line (@lines) {
if ($line =~ /<!--begin-->/) {
print GUEST ("<!--begin-->\n");
print GUEST ("<p>New message:</p>");
if ($INPUT{'pubcom'}) {
$INPUT{'comments'} =~ s/\cM\n/<br>\n/g;
$mailcomments = $INPUT{'comments'};
$mailcomments =~ s/<br>//g;
print GUEST ("<p>$INPUT{'pubcom'}</p><br>");
}
print GUEST ("<p>This message was posted by <b>$INPUT{'alias'}</b> on $date</p><hr>\n\n");
} else {
print GUEST ("$line");
}
Any simple script line I can add to the cgi file so that if the public fields are empty, the script does not print anything in the visitors book but still follows all the other commands?
If anybody is interested in how we adapted the script, be glad to share it, just let me know.