#!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" Author: "Carl Sassenrath" Date: 14-Sep-1999 File: %cgicomment.r Purpose: {Allows viewers to add comments to a web page. (needs webcomment.r to create example forms file).} 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. } Category: [cgi net markup tutor 3] ] ;-- Output HTTP header first, just in case an error occurs ; the user will be able to see it and report it to you. print "Content-Type: text/html^/" ;-- Uncomment this line for debugging purposes: ;print system/options/cgi/query-string ;-- A function which creates the HTML used for the comments ; table. It was created in a visual editor and pasted here. ; Note that everything except the variables of the function ; must be written as a tag or as a string. When called ; this function creates the table row and returns it as text. make-comment: func [from date comment] [ reform [
"From:"
"Comment:"
" cgi/comment]][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 new-comment write file page ;-- Display the page again: print page