I actually do have a label calling the story name, it's just called "storyname". Here, I'll post the code for the whole thing here (but I'll change a couple things just to keep it safe and private):
#!/usr/bin/perl
# Set Variables
$guestbookurl = "http://www.MYSITEURL.com/stories.htm";
$guestbookreal = "/PATH/TO/MY/STORIES/PAGE/stories.htm";
$guestlog = "/PATH/TO/MY/LOG/storyguestlog.html";
$cgiurl = "http://www.royandstellawood.com/cgi-bin/storyguestbook.pl";
$date_command = "/bin/date";
# Set Your Options:
$mail = 1; # 1 = Yes; 0 = No
$uselog = 0; # 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 = 1; # 1 = Yes; 0 = No
$allow_html = 0; # 1 = Yes; 0 = No
$line_breaks = 0; # 1 = Yes; 0 = No
$fromaddress = 'EMAILADDRESS@MYURL.com';
# If you answered 1 to $mail or $remote_mail you will need to fill out
# these variables below:
$mailprog = '/usr/lib/sendmail';
$recipient = 'EMAILADDRESS@MYURL.com';
# Done
##############################################################################
# Get the Date for Entry
$date = `$date_command +"%A, %B %d, %Y"`; 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 ( $FORM{'storyname'} ){
print GUEST "<h1><b><center>$FORM{'storyname'}</center></h1></b>\n";
}
print GUEST "<a href=\"#Top\"><u>(return to top)</u></a>\n";
if ($FORM{'url'}) {
print GUEST "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
}
else {
print GUEST "Submitted by: <b>$FORM{'realname'}</b>";
}
if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print GUEST " \<<a href=\"mailto:$FORM{'username'}\">";
print GUEST "$FORM{'username'}</a>\>";
}
else {
print GUEST "Email: <b>$FORM{'username'}</b>";
}
}
print GUEST "\n";
print GUEST "Date Submitted: $date\n";
if ( $FORM{'intro'} ){
print GUEST "Story Introduction: $FORM{'intro'}<p>\n";
}
print GUEST "<b>Story:</b>\n";
$story=$FORM{'story'};
$story =~s/\n//gi;
print GUEST "$story\n";
print GUEST "<hr>\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'}\n";
print MAIL "From: $FORM{'username'}\n";
print MAIL "Subject: New Story Submission\n\n";
print MAIL "$FORM{'realname'} from email address $FORM{'username'} has posted a story to the web site.\n\n";
print MAIL "Name: $FORM{'realname'}\n";
print MAIL "Name of Story: $FORM{'storyname'}\n";
print MAIL "Introduction to Story: $FORM{'intro'}\n";
print MAIL "Story:\n";
print MAIL "$FORM{'story'}\n\n";
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: $fromaddress\n";
print MAIL "Subject: New Story Submission\n\n";
print MAIL "You are receiving this email because you submitted a story to the website.\n";
print MAIL "Below is what you submitted.\n\n";
print MAIL "Name: $FORM{'realname'}\n";
print MAIL "Email Address: $FORM{'username'}\n";
print MAIL "Name of Story: $FORM{'storyname'}\n";
print MAIL "Story:\n";
print MAIL "$FORM{'story'}\n\n";
print MAIL "-$date\n";
close (MAIL);
}
# Print Out Initial Output Location Heading
if ($redirection eq '1') {
print "Location: $guestbookurl\n\n";
}
else {
&no_redirection;
}
# Log the Entry or Error
sub log {
$log_type = $_[0];
open (LOG, ">>$guestlog");
if ($log_type eq 'entry') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate]\n";
}
elsif ($log_type eq 'no_name') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No Name\n";
}
elsif ($log_type eq 'no_comments') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No ";
print LOG "Comments\n";
}
}
# Redirection Option
sub no_redirection {
# Print Beginning of HTML
print "Content-Type: text/html\n\n";
print "<html><head><title><center>Thank you.</center></title></head>\n";
print "<body bgcolor=\"ece4dd\">\n";
print "<body><h1><center>Thank you for submitting your story.</h1></center>\n";
print "<body><Center>A copy of your story has been sent to your email address.</center>\n";
print "<body><Center>Click <a href=\"/stories.htm\">HERE</a> to return to the stories page.</center>\n";
print "<body><center>You may have to refresh the page to see your story.\n";
# Print End of HTML
print "<hr>\n";
print "</body></html>\n";
exit;
}
I know it's long posting all that, but I thought it would be somewhat helpful. Anyway, I figure I can just use the same code for posting the story, but change the comment in the HTML it looks for.
Then once I get it posting there, then couldn't I just name a tag $storylink={'storyname'} or something, and then just have it post somthing like:
print GUEST "<a href=\"#storyname\"><u>$FORM{'storyname'}</u></a>\n";
I know the syntax might not be correct, but wouldn't that work?
Then I guess if I can get that one working, then I would have to figure out how to get it to start posting in columns or something, so it doesn't just post this huge list of story names that you have to scroll down to see anyway.
I know this may be too much to do just re-writting matt's Script. But I couldn't find any other scripts out there to do this story posting thing. I found plenty of scripts that would post like a never-ending story type thing, but not like what I'm doing.
Thanks for your help.
Nate