Or you could create a session ID based on the date and time, as
follows...
time-in-digits: func [
"convert the date and time from 'now' into a string of digits"
sun-dial [date!] "the current date and time from 'now'"
][
year: to-string sun-dial/year
month: to-string sun-dial/month
if (length? month) < 2 [insert month "0"]
day: to-string sun-dial/day
if (length? day) < 2 [insert day "0"]
current-time: sun-dial/time
hour: to-string current-time/hour
if (length? hour) < 2 [insert hour "0"]
minutes: to-string current-time/minute
if (length? minutes) < 2 [insert minutes "0"]
seconds: to-string current-time/second
if (length? seconds) < 2 [insert seconds "0"]
rejoin [year month day hour minutes seconds]
]
>> file: time-in-digits now
== "20000610224640"
>> file: to-file join file ".sid"
== %20000610224640.sid
This works fine so long as you do not need to create more than one
session ID during the same exact second. It also allows you to
recognize which session IDs were created most recently (they will
always appear at the tail of the directory.)
BTW: Is there any way to make REBOL output fractions of a second?
(tenths, hundredths, thousands, etc., of a second.)
-Ryan
>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
>
>
>