/* Move the next line to the top of the file if you are running on a Unix machine
#!/usr/local/bin/rexx
*/
Parse Arg Argv
Parse Source OperatingSystem CallType
env = "OS2ENVIRONMENT"
vtab = ""
lead = "
"
Argc = Words(Argv)
Select
When OperatingSystem="OS/2" then do
method = value("REQUEST_METHOD",,env)
cookie = value("HTTP_COOKIE",,env)
len = value("CONTENT_LENGTH",,env)
if (method == "GET") Then Do
query_string = value("QUERY_STRING",,env)
end
End
Otherwise /* We're on a Unix machine */
method=getenv("REQUEST_METHOD")
cookie=getenv("HTTP_COOKIE")
len = getenv("CONTENT_LENGTH")
if (method=="GET") then do
query_string=getenv("QUERY_STRING")
end
If (method == "POST") & (len \= "") Then Do
/* use POST method to pass parameters */
post_string = charin(,,len)
query_string = post_string
End
End /* Select */
Session_ID="SESSION_ID="||Right(Random(1,99999),5,"0")||Right(Random(1,99999),5,"0")
newcookie='Set-Cookie: '||Session_ID||'; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT path=/'
Call Header
Say "Old cookie was" cookie ""
Say "New cookie will be" Session_ID "
"
Exit
Header:
Say "Content-type: text/html"
Say newcookie
Say ""
Say "CGI Results:
"
Return