Got an application I'm writing(a mailing list address accumulator for my
company's web sites. e-commerce rules). It's a three step process. They fill
out the form (generated by a REBOL script), I use CGI to call another REBOL
script which checks to make sure all the required fields are filled out and
that some choices (for the various lists) have been checked. No continuing
until its satisfied.

Now comes the tough part. I could not figure an easy way to include another
script to record the data (it can be writing to as many as 45 different
lists) since I'm dependant on the person filling in the form deciding
everything is correct and clicking on a 'continue' button.

My solution? I decided to create a session ID, save the data in a file of
this name, then call the last script and pass the session ID to it. Lots of
good applications for SIDs. This works great and I'm sharing the code with
you folks in hope of some helpful suggestions of making it even better. If
not (it already works fine), well maybe somebody will learn something
(possibly, even me<g>).

Here's the code:
---------------------

letter: "abcdefghijklmnopqrstuvwxyz"

random/seed now

l1: pick letter random 26
l1: join l1 pick letter random 26
l2: pick letter random 26
l2: join l2 pick letter random 26
l3: pick letter random 26
l3: join l3 pick letter random 26
l4: pick letter random 26
l4: join l4 pick letter random 26

file: join l1 random 1000000
file: join file l2
file: join file l3
file: join file random 1000000
file: join file l4
file: to-file join file ".sid"   ; do all this to get
                                 ; a REALLY unique SID

save file data

call: join "/cgi-bin/address3.r" file

print {<a href="}                 ; make a URL of it
print call
print {"><B>CONTINUE</B></a>.}    ; clicking on CONTINUE passes info

------------------------------------------

The SID call will look something like
/cgi-bin/address3.r?wu258907oitg169005zu.sid

The called script reads in the data file name via the system/script/args
object, gets the file, and deletes it to avoid cluttering up your system. It
then processes and writes/appends to the proper address file or files.

I'll have the entire thing up where anyone can look at it shortly.

--Ralph Roberts


Reply via email to