home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD1070210162000.psc / wwwboard.cgi < prev   
Encoding:
Text File  |  2000-09-10  |  21.2 KB  |  592 lines

  1. #!/usr/local/bin/perl
  2. ##############################################################################
  3. # WWWBoard                      Version 2.0 ALPHA 2.1                        #
  4. # Copyright 1996 Matt Wright    mattw@worldwidemart.com                      #
  5. # Created 10/21/95              Last Modified 11/25/95                       #
  6. # Security Patches/Bug Fixes:   January 07, 2000                             #
  7. # Scripts Archive at:           http://www.worldwidemart.com/scripts/        #
  8. ##############################################################################
  9. # COPYRIGHT NOTICE                                                           # 
  10. # Copyright 1996 Matthew M. Wright  All Rights Reserved.                     #
  11. #                                                                            #
  12. # WWWBoard may be used and modified free of charge by anyone so long as      #
  13. # this copyright notice and the comments above remain intact.  By using this # 
  14. # code you agree to indemnify Matthew M. Wright from any liability that      #  
  15. # might arise from it's use.                                                 #  
  16. #                                                                            #
  17. # Selling the code for this program without prior written consent is         # 
  18. # expressly forbidden.  In other words, please ask first before you try and  # 
  19. # make money off of my program.                                              #
  20. #                                                                            #
  21. # Obtain permission before redistributing this software over the Internet or #
  22. # in any other medium.  In all cases copyright and header must remain intact.#
  23. ##############################################################################
  24. # Define Variables
  25.  
  26. $basedir = "/data1/hypermart.net/elucidsoftware/cgi";
  27. $baseurl = "http://elucidsoftware.hypermart.net/cgi";
  28. $cgi_url = "http://elucidsoftware.hypermart.net/cgi/wwwboard.cgi";
  29.  
  30. $mesgdir = "messages";
  31. $datafile = "data.txt";
  32. $mesgfile = "wwwboard.html";
  33. $faqfile = "faq.html";
  34.  
  35. $ext = "html";
  36.  
  37. $title = "WWWBoard Version 2.0 Test";
  38.  
  39. # Done
  40. ###########################################################################
  41.  
  42. ###########################################################################
  43. # Configure Options
  44.  
  45. $show_faq = 1;        # 1 - YES; 0 = NO
  46. $allow_html = 1;    # 1 = YES; 0 = NO
  47. $quote_text = 1;    # 1 = YES; 0 = NO
  48. $subject_line = 0;    # 0 = Quote Subject Editable; 1 = Quote Subject 
  49.             #   UnEditable; 2 = Don't Quote Subject, Editable.
  50. $use_time = 1;        # 1 = YES; 0 = NO
  51.  
  52. $show_poster_ip = 1;    # 1 = Show the IP of every poster; 0 = Don't
  53. $enforce_max_len = 0;   # 2 = YES, error; 1 = YES, truncate; 0 = NO
  54. %max_len = ('name', 50, 
  55.             'email', 70, 
  56.             'subject', 80, 
  57.             'url', 150, 
  58.             'url_title', 80,
  59.             'img', 150,
  60.             'body', 3000,
  61.             'origsubject', 80,
  62.             'origname', 50,
  63.             'origemail', 70,
  64.             'origdate', 50);
  65. # Done
  66. ###########################################################################
  67.  
  68. # Get the Data Number
  69. &get_number;
  70.  
  71. # Get Form Information
  72. &parse_form;
  73.  
  74. # Put items into nice variables
  75. &get_variables;
  76.  
  77. # Open the new file and write information to it.
  78. &new_file;
  79.  
  80. # Open the Main WWWBoard File to add link
  81. &main_page;
  82.  
  83. # Now Add Thread to Individual Pages
  84. if ($num_followups >= 1) {
  85.    &thread_pages;
  86. }
  87.  
  88. # Return the user HTML
  89. &return_html;
  90.  
  91. # Increment Number
  92. &increment_num;
  93.  
  94. ############################
  95. # Get Data Number Subroutine
  96.  
  97. sub get_number {
  98.    open(NUMBER,"$basedir/$datafile");
  99.    $num = <NUMBER>;
  100.    close(NUMBER);
  101.    if ($num == 999999 || $num !~ /^\d+$/)  {
  102.       $num = "1";
  103.    }
  104.    else {
  105.       $num++;
  106.    }
  107. }
  108.  
  109. #######################
  110. # Parse Form Subroutine
  111.  
  112. sub parse_form {
  113.    local($name,$value);
  114.  
  115.    # Get the input
  116.    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  117.  
  118.    # Split the name-value pairs
  119.    @pairs = split(/&/, $buffer);
  120.  
  121.    foreach $pair (@pairs) {
  122.       ($name, $value) = split(/=/, $pair);
  123.  
  124.       # Un-Webify plus signs and %-encoding
  125.       $value =~ tr/+/ /;
  126.       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  127.  
  128.       # Remove any NULL characters, Server Side Includes
  129.       $value =~ s/\0//g;
  130.       $value =~ s/<!--(.|\n)*-->//g;
  131.  
  132.       if ($allow_html != 1) {
  133.          $value =~ s/<([^>]|\n)*>//g;
  134.       }
  135.       else {
  136.          unless ($name eq 'body') {
  137.         $value =~ s/<([^>]|\n)*>//g;
  138.          }
  139.       }
  140.  
  141.       $FORM{$name} = $value;
  142.    }
  143.  
  144.    # Make sure that message fields do not exceed allowed value
  145.    if ($enforce_max_len) {
  146.       foreach $name (keys %max_len) {
  147.          if (length($FORM{$name}) > $max_len{$name}) {
  148.             if ($enforce_max_len == 2) { &error('field_size'); }
  149.             else { $FORM{$name} = sprintf("%.$max_len{$name}s",$FORM{$name}); }
  150.          }
  151.       }
  152.    }
  153. }
  154.  
  155. ###############
  156. # Get Variables
  157.  
  158. sub get_variables {
  159.  
  160.    if ($FORM{'followup'}) {
  161.       $followup = "1";
  162.       @followup_num = split(/,/,$FORM{'followup'});
  163.  
  164.       # Changes based in part on information contained in BugTraq archives
  165.       # message 'WWWBoard Vulnerability' posted by Samuel Sparling Nov-09-1998.
  166.       # Also requires that each followup number is in fact a number, to 
  167.       # prevent message clobbering.
  168.  
  169.       local(%fcheck);
  170.       foreach $fn (@followup_num) {
  171.          if ($fn !~ /^\d+$/ || $fcheck{$fn}) { &error('followup_data'); }
  172.          $fcheck{$fn} = 1;
  173.       }
  174.       @followup_num = keys %fcheck;
  175.  
  176.       $num_followups = @followups = @followup_num;
  177.       $last_message = pop(@followups);
  178.       $origdate = "$FORM{'origdate'}";
  179.       $origname = "$FORM{'origname'}";
  180.       $origsubject = "$FORM{'origsubject'}";
  181.    }
  182.    else {
  183.       $followup = "0";
  184.    }
  185.  
  186.    if ($FORM{'name'}) {
  187.       $name = "$FORM{'name'}";
  188.       $name =~ s/"//g;
  189.       $name =~ s/<//g;
  190.       $name =~ s/>//g;
  191.       $name =~ s/\&//g;
  192.    }
  193.    else {
  194.       &error(no_name);
  195.    }
  196.  
  197.    if ($FORM{'email'} =~ /.*\@.*\..*/) {
  198.       $email = "$FORM{'email'}";
  199.    }
  200.  
  201.    if ($FORM{'subject'}) {
  202.       $subject = "$FORM{'subject'}";
  203.       $subject =~ s/\&/\&\;/g;
  204.       $subject =~ s/"/\"\;/g;
  205.    }
  206.    else {
  207.       &error(no_subject);
  208.    }
  209.  
  210.    if ($FORM{'url'} =~ /.*\:.*\..*/ && $FORM{'url_title'}) {
  211.       $message_url = "$FORM{'url'}";
  212.       $message_url_title = "$FORM{'url_title'}";
  213.    }
  214.  
  215.    if ($FORM{'img'} =~ /.*tp:\/\/.*\..*/) {
  216.       $message_img = "$FORM{'img'}";
  217.    }
  218.  
  219.    if ($FORM{'body'}) {
  220.       $body = "$FORM{'body'}";
  221.       $body =~ s/\cM//g;
  222.       $body =~ s/\n\n/<p>/g;
  223.       $body =~ s/\n/<br>/g;
  224.  
  225.       $body =~ s/</</g; 
  226.       $body =~ s/>/>/g; 
  227.       $body =~ s/"/"/g;
  228.    }
  229.    else {
  230.       &error(no_body);
  231.    }
  232.  
  233.    if ($quote_text == 1) {
  234.       $hidden_body = "$body";
  235.       $hidden_body =~ s/</</g;
  236.       $hidden_body =~ s/>/>/g;
  237.       $hidden_body =~ s/"/"/g;
  238.    }
  239.  
  240.    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
  241.  
  242.    $month = ($mon + 1);
  243.  
  244.    @months = ("January","February","March","April","May","June","July","August","September","October","November","December");
  245.  
  246.    $year += 1900;
  247.    $long_date = sprintf("%s %02d, %4d at %02d:%02d:%02d",$months[$mon],$mday,$year,$hour,$min,$sec);
  248.  
  249.    $year %= 100;
  250.    if ($use_time == 1) {
  251.       $date = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$month,$mday,$year);
  252.    }
  253.    else {
  254.       $date = sprintf("%02d/%02d/%02d",$month,$mday,$year);
  255.    }
  256. }      
  257.  
  258. #####################
  259. # New File Subroutine
  260.  
  261. sub new_file {
  262.  
  263.    open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
  264.    print NEWFILE "<html>\n";
  265.    print NEWFILE "  <head>\n";
  266.    print NEWFILE "    <title>$subject</title>\n";
  267.    print NEWFILE "  </head>\n";
  268.    print NEWFILE "  <body link=\"#3366CC\" vlink=\"#3366CC\" alink=\"#0033CC\">\n";
  269.    print NEWFILE "    <center>\n";
  270.    print NEWFILE "      <h1>$subject</h1>\n";
  271.    print NEWFILE "    </center>\n";
  272.    print NEWFILE "<hr size=1 color=\"#0099FF\" width=75%>\n";
  273.    if ($show_faq == 1) {
  274.       print NEWFILE "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ] [ <a href=\"$baseurl/$faqfile\">FAQ</a> ]</center>\n";
  275.    }
  276.    else {
  277.       print NEWFILE "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ]</center>\n";
  278.    }
  279.    print NEWFILE "<hr size=1 color=\"#0099FF\" width=75%><p>\n";
  280.  
  281.    print NEWFILE "Posted by ";
  282.  
  283.    if ($email) {
  284.       print NEWFILE "<a href=\"mailto:$email\">$name</a> ";
  285.    }
  286.    else {
  287.       print NEWFILE "$name \n";
  288.    }
  289.    if ($show_poster_ip) { print NEWFILE "($ENV{'REMOTE_ADDR'}) "; }
  290.    print NEWFILE "on $long_date:<p>\n";
  291.  
  292.    if ($followup == 1) {
  293.       print NEWFILE "In Reply to: <a href=\"$last_message\.$ext\">$origsubject</a> posted by ";
  294.  
  295.       if ($origemail) {
  296.          print NEWFILE "<a href=\"$origemail\">$origname</a> on $origdate:<p>\n";
  297.       }
  298.       else {
  299.          print NEWFILE "$origname on $origdate:<p>\n";
  300.       }
  301.    }
  302.  
  303.    if ($message_img) {
  304.       print NEWFILE "<center><img src=\"$message_img\"></center><p>\n";
  305.    }
  306.    print NEWFILE "$body\n";
  307.    print NEWFILE "<br>\n";
  308.    if ($message_url) {
  309.       print NEWFILE "<ul><li><a href=\"$message_url\">$message_url_title</a></ul>\n";
  310.    }
  311.    print NEWFILE "<br><hr size=1 color=\"#0099FF\"  width=75%><p>\n";
  312.    print NEWFILE "<a name=\"followups\">Follow Ups:</a><br>\n";
  313.    print NEWFILE "<ul><!--insert: $num-->\n";
  314.    print NEWFILE "</ul><!--end: $num-->\n";
  315.    print NEWFILE "<br><hr size=7 width=75%><p>\n";
  316.    print NEWFILE "<a name=\"postfp\">Post a Followup</a><p>\n";
  317.    print NEWFILE "<form method=POST action=\"$cgi_url\">\n";
  318.    print NEWFILE "<input type=hidden name=\"followup\" value=\"";
  319.    if ($followup == 1) {
  320.       foreach $followup_num (@followup_num) {
  321.          print NEWFILE "$followup_num,";
  322.       }
  323.    }
  324.    print NEWFILE "$num\">\n";
  325.    print NEWFILE "<input type=hidden name=\"origname\" value=\"$name\">\n";
  326.    if ($email) {
  327.       print NEWFILE "<input type=hidden name=\"origemail\" value=\"$email\">\n";
  328.    }
  329.    print NEWFILE "<input type=hidden name=\"origsubject\" value=\"$subject\">\n";
  330.    print NEWFILE "<input type=hidden name=\"origdate\" value=\"$long_date\">\n";
  331.    print NEWFILE "Name: <input type=text name=\"name\" size=50><br>\n";
  332.    print NEWFILE "E-Mail: <input type=text name=\"email\" size=50><p>\n";
  333.    if ($subject_line == 1) {
  334.       if ($subject_line =~ /^Re:/) {
  335.          print NEWFILE "<input type=hidden name=\"subject\" value=\"$subject\">\n";
  336.          print NEWFILE "Subject: <b>$subject</b><p>\n";
  337.       }
  338.       else {
  339.          print NEWFILE "<input type=hidden name=\"subject\" value=\"Re: $subject\">\n";
  340.          print NEWFILE "Subject: <b>Re: $subject</b><p>\n";
  341.       }
  342.    } 
  343.    elsif ($subject_line == 2) {
  344.       print NEWFILE "Subject: <input type=text name=\"subject\" size=50><p>\n";
  345.    }
  346.    else {
  347.       if ($subject =~ /^Re:/) {
  348.          print NEWFILE "Subject: <input type=text name=\"subject\"value=\"$subject\" size=50><p>\n";
  349.       }
  350.       else {
  351.          print NEWFILE "Subject: <input type=text name=\"subject\" value=\"Re: $subject\" size=50><p>\n";
  352.       }
  353.    }
  354.    print NEWFILE "Comments:<br>\n";
  355.    print NEWFILE "<textarea name=\"body\" COLS=50 ROWS=10>\n";
  356.    if ($quote_text == 1) {
  357.       @chunks_of_body = split(/\<\;p\>\;/,$hidden_body);
  358.       foreach $chunk_of_body (@chunks_of_body) {
  359.          @lines_of_body = split(/\<\;br\>\;/,$chunk_of_body);
  360.          foreach $line_of_body (@lines_of_body) {
  361.             print NEWFILE ": $line_of_body\n";
  362.          }
  363.          print NEWFILE "\n";
  364.       }
  365.    }
  366.    print NEWFILE "</textarea>\n";
  367.    print NEWFILE "<p>\n";
  368.    print NEWFILE "Optional Link URL: <input type=text name=\"url\" size=50><br>\n";
  369.    print NEWFILE "Link Title: <input type=text name=\"url_title\" size=48><br>\n";
  370.    print NEWFILE "Optional Image URL: <input type=text name=\"img\" size=49><p>\n";
  371.    print NEWFILE "<input type=submit value=\"Submit Follow Up\"> <input type=reset>\n";
  372.    print NEWFILE "<p><hr size=7 width=75%>\n";
  373.    if ($show_faq == 1) {
  374.       print NEWFILE "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ] [ <a href=\"$baseurl/$faqfile\">FAQ</a> ]</center>\n";
  375.    }
  376.    else {
  377.       print NEWFILE "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ]</center>\n";
  378.    }
  379.    print NEWFILE "</body></html>\n";
  380.    close(NEWFILE);
  381. }
  382.  
  383. ###############################
  384. # Main WWWBoard Page Subroutine
  385.  
  386. sub main_page {
  387.    open(MAIN,"$basedir/$mesgfile") || die $!;
  388.    @main = <MAIN>;
  389.    close(MAIN);
  390.  
  391.    open(MAIN,">$basedir/$mesgfile") || die $!;
  392.    if ($followup == 0) {
  393.       foreach $main_line (@main) {
  394.          if ($main_line =~ /<!--begin-->/) {
  395.             print MAIN "<!--begin-->\n";
  396.         print MAIN "<!--top: $num--><li><a href=\"$mesgdir/$num\.$ext\">$subject</a> - <b>$name</b> <i>$date</i>\n";
  397.             print MAIN "(<!--responses: $num-->0)\n";
  398.             print MAIN "<ul><!--insert: $num-->\n";
  399.             print MAIN "</ul><!--end: $num-->\n";
  400.          }
  401.          else {
  402.             print MAIN "$main_line";
  403.          }
  404.       }
  405.    }
  406.    else {
  407.       foreach $main_line (@main) {
  408.      $work = 0;
  409.          if ($main_line =~ /<ul><!--insert: $last_message-->/) {
  410.             print MAIN "<ul><!--insert: $last_message-->\n";
  411.             print MAIN "<!--top: $num--><li><a href=\"$mesgdir/$num\.$ext\">$subject</a> - <b>$name</b> <i>$date</i>\n";
  412.             print MAIN "(<!--responses: $num-->0)\n";
  413.             print MAIN "<ul><!--insert: $num-->\n";
  414.             print MAIN "</ul><!--end: $num-->\n";
  415.          }
  416.          elsif ($main_line =~ /\(<!--responses: (.*)-->(.*)\)/) {
  417.             $response_num = $1;
  418.             $num_responses = $2;
  419.             $num_responses++;
  420.             foreach $followup_num (@followup_num) {
  421.                if ($followup_num == $response_num) {
  422.                   print MAIN "(<!--responses: $followup_num-->$num_responses)\n";
  423.           $work = 1;
  424.                }
  425.             }
  426.             if ($work != 1) {
  427.                print MAIN "$main_line";
  428.             }
  429.          }
  430.          else {
  431.             print MAIN "$main_line";
  432.          }
  433.       }
  434.    }
  435.    close(MAIN);
  436. }
  437.  
  438. ############################################
  439. # Add Followup Threading to Individual Pages
  440. sub thread_pages {
  441.  
  442.    foreach $followup_num (@followup_num) {
  443.       open(FOLLOWUP,"$basedir/$mesgdir/$followup_num\.$ext");
  444.       @followup_lines = <FOLLOWUP>;
  445.       close(FOLLOWUP);
  446.  
  447.       open(FOLLOWUP,">$basedir/$mesgdir/$followup_num\.$ext");
  448.       foreach $followup_line (@followup_lines) {
  449.          $work = 0;
  450.          if ($followup_line =~ /<ul><!--insert: $last_message-->/) {
  451.         print FOLLOWUP "<ul><!--insert: $last_message-->\n";
  452.             print FOLLOWUP "<!--top: $num--><li><a href=\"$num\.$ext\">$subject</a> <b>$name</b> <i>$date</i>\n";
  453.             print FOLLOWUP "(<!--responses: $num-->0)\n";
  454.             print FOLLOWUP "<ul><!--insert: $num-->\n";
  455.             print FOLLOWUP "</ul><!--end: $num-->\n";
  456.          }
  457.          elsif ($followup_line =~ /\(<!--responses: (.*)-->(.*)\)/) {
  458.             $response_num = $1;
  459.             $num_responses = $2;
  460.             $num_responses++;
  461.             foreach $followup_num (@followup_num) {
  462.                if ($followup_num == $response_num) {
  463.                   print FOLLOWUP "(<!--responses: $followup_num-->$num_responses)\n";
  464.                   $work = 1;
  465.                }
  466.             }
  467.             if ($work != 1) {
  468.                print FOLLOWUP "$followup_line";
  469.             }
  470.          }
  471.          else {
  472.             print FOLLOWUP "$followup_line";
  473.          }
  474.       }
  475.       close(FOLLOWUP);
  476.    }
  477. }
  478.  
  479. sub return_html {
  480.    print "Content-type: text/html\n\n";
  481.    print "<html><head><title>Message Added: $subject</title></head>\n";
  482.    print "<body><center><h1>Message Added: $subject</h1></center>\n";
  483.    print "The following information was added to the message board:<p><hr size=7 width=75%><p>\n";
  484.    print "<b>Name:</b> $name<br>\n";
  485.    print "<b>E-Mail:</b> $email<br>\n";
  486.    print "<b>Subject:</b> $subject<br>\n";
  487.    print "<b>Body of Message:</b><p>\n";
  488.    print "$body<p>\n";
  489.    if ($message_url) {
  490.       print "<b>Link:</b> <a href=\"$message_url\">$message_url_title</a><br>\n";
  491.    }
  492.    if ($message_img) {
  493.       print "<b>Image:</b> <img src=\"$message_img\"><br>\n";
  494.    }
  495.    print "<b>Added on Date:</b> $date<p>\n";
  496.    print "<hr size=7 width=75%>\n";
  497.    print "<center>[ <a href=\"$baseurl/$mesgdir/$num\.$ext\">Go to Your Message</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ]</center>\n";
  498.    print "</body></html>\n";
  499. }
  500.  
  501. sub increment_num {
  502.    open(NUM,">$basedir/$datafile") || die $!;
  503.    print NUM "$num";
  504.    close(NUM);
  505. }
  506.  
  507. sub error {
  508.    $error = $_[0];
  509.  
  510.    print "Content-type: text/html\n\n";
  511.  
  512.    if ($error eq 'no_name') {
  513.       print "<html><head><title>$title ERROR: No Name</title></head>\n";
  514.       print "<body><center><h1>ERROR: No Name</h1></center>\n";
  515.       print "You forgot to fill in the 'Name' field in your posting.  Correct it below and re-submit.  The necessary fields are: Name, Subject and Message.<p><hr size=7 width=75%><p>\n";
  516.       &rest_of_form;
  517.    }
  518.    elsif ($error eq 'no_subject') {
  519.       print "<html><head><title>$title ERROR: No Subject</title></head>\n";
  520.       print "<body><center><h1>ERROR: No Subject</h1></center>\n";
  521.       print "You forgot to fill in the 'Subject' field in your posting.  Correct it below and re-submit.  The necessary fields are: Name, Subject and Message.<p><hr size=7 width=75%><p>\n";
  522.       &rest_of_form;
  523.    }
  524.    elsif ($error eq 'no_body') {
  525.       print "<html><head><title>$title ERROR: No Message</title></head>\n";
  526.       print "<body><center><h1>ERROR: No Message</h1></center>\n";
  527.       print "You forgot to fill in the 'Message' field in your posting.  Correct it below and re-submit.  The necessary fields are: Name, Subject and Message.<p><hr size=7 width=75%><p>\n";
  528.       &rest_of_form;
  529.    }
  530.    elsif ($error eq 'field_size') {
  531.       printf "<html><head><title>$title ERROR: Field too Long</title></head>\n";
  532.       print "<body><center><h1>ERROR: Field too Long</h1></center>\n";
  533.       print "One of the form fields in the message submission was too long.  The following are the limits on the size of each field (in characters):<p><ul>\n";
  534.       print "<li>Name: $max_len{'name'}\n";
  535.       print "<li>E-Mail: $max_len{'email'}\n";
  536.       print "<li>Subject: $max_len{'subject'}\n";
  537.       print "<li>Body: $max_len{'body'}\n";
  538.       print "<li>URL: $max_len{'url'}\n";
  539.       print "<li>URL Title: $max_len{'url_title'}\n";
  540.       print "<li>Image URL: $max_len{'img'}\n";
  541.       print "</ul>Please modify the form data and resubmit.<p><hr size=7 width=75%><p>\n";
  542.       &rest_of_form;
  543.    }
  544.    else {
  545.       print "ERROR!  Undefined.\n";
  546.    }
  547.    exit;
  548. }
  549.  
  550. sub rest_of_form {
  551.  
  552.    print "<form method=POST action=\"$cgi_url\">\n";
  553.  
  554.    if ($followup == 1) {
  555.       print "<input type=hidden name=\"origsubject\" value=\"$FORM{'origsubject'}\">\n";
  556.       print "<input type=hidden name=\"origname\" value=\"$FORM{'origname'}\">\n";
  557.       print "<input type=hidden name=\"origemail\" value=\"$FORM{'origemail'}\">\n";
  558.       print "<input type=hidden name=\"origdate\" value=\"$FORM{'origdate'}\">\n";
  559.       print "<input type=hidden name=\"followup\" value=\"$FORM{'followup'}\">\n";
  560.    }
  561.    print "Name: <input type=text name=\"name\" value=\"$FORM{'name'}\" size=50><br>\n";
  562.    print "E-Mail: <input type=text name=\"email\" value=\"$FORM{'email'}\" size=50><p>\n";
  563.    if ($subject_line == 1) {
  564.       print "<input type=hidden name=\"subject\" value=\"$FORM{'subject'}\">\n";
  565.       print "Subject: <b>$FORM{'subject'}</b><p>\n";
  566.    } 
  567.    else {
  568.       print "Subject: <input type=text name=\"subject\" value=\"$FORM{'subject'}\" size=50><p>\n";
  569.    }
  570.    print "Message:<br>\n";
  571.    print "<textarea COLS=50 ROWS=10 name=\"body\">\n";
  572.    $FORM{'body'} =~ s/</</g;
  573.    $FORM{'body'} =~ s/>/>/g;
  574.    $FORM{'body'} =~ s/"/"/g;
  575.    print "$FORM{'body'}\n";
  576.    print "</textarea><p>\n";
  577.    print "Optional Link URL: <input type=text name=\"url\" value=\"$FORM{'url'}\" size=45><br>\n";
  578.    print "Link Title: <input type=text name=\"url_title\" value=\"$FORM{'url_title'}\" size=50><br>\n";
  579.    print "Optional Image URL: <input type=text name=\"img\" value=\"$FORM{'img'}\" size=45><p>\n";
  580.    print "<input type=submit value=\"Post Message\"> <input type=reset>\n";
  581.    print "</form>\n";
  582.    print "<br><hr size=7 width=75%>\n";
  583.    if ($show_faq == 1) {
  584.       print "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ] [ <a href=\"$baseurl/$faqfile\">FAQ</a> ]</center>\n";
  585.    }
  586.    else {
  587.       print "<center>[ <a href=\"#followups\">Follow Ups</a> ] [ <a href=\"#postfp\">Post Followup</a> ] [ <a href=\"$baseurl/$mesgfile\">$title</a> ]</center>\n";
  588.    }
  589.    print "</body></html>\n";
  590. }  
  591.  
  592.