Rebol and E-mail Services
by Michael Swaine

Listing One
#!rebol -cs
;-- The above lines are used by Apache CGI to launch REBOL and run this 
;   script. The -cs is used to indicate that it is a CGI script and that 
;   security is lowered to allow REBOL to read and write local files.
REBOL [
    Title: "CGI Web Page Comment Poster"
    Date:  1-September-1999
    Needs: 2.1.2
    Note:  {
        For each article, in the comment posting form, be sure
        to modify the hidden "file" field value to give it the
        correct name of the HTML file to receive the comments.
        Also, the HTML file must have an HTML comment to note
        where the table insertion is made.  See comments below.
    }
]
;-- A function to create the HTML used for the comments.
make-comment: func [from date comment] [
   ;-- This function, which just returns some HTML, has been deleted.
]
;-- Process the CGI query string, making an object from its fields.
cgi: make object! decode-cgi system/options/cgi/query-string

;-- The file name of the article is provided in a hidden input
;   field within the HTML of the article.  Use this string to
;   build the path to the file from CGI dir.  Remember that the
;       file must have write permissions if you want add comments.
file: join %../web/ cgi/file

;-- Create the text of the new comment from the CGI input.
;       If the type is code, then display it as preformated TTY.
new-comment: make-comment cgi/from now either cgi/type = "code" [
        rejoin ["<pre>" cgi/comment </pre>]][cgi/comment]

;-- Read the HTML file, add the newest comment to it, and write
;   it out.  An HTML comment is used to mark where it goes.
page: read file
insert find page <!--comments--> new-comment
write file page

;-- Display the page again:
print page






    

1


