Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: "picking" a value from the CGI object...
Pages: [1] Print
Author Topic: "picking" a value from the CGI object...  (Read 380 times)
jfdutcher
Jr. Member
**
Offline Offline

Posts: 95


View Profile
"picking" a value from the CGI object...
« on: June 05, 2007, 04:01:32 AM »

The brief script below wants to exercise the script from the script library as a CGI script on the server. So far, no attempted use of the term  "cgi/:name"  satisfys the script line " file: to-file  cgi/:name "  without getting an error.
This term does work when simply "printing" the "cgi/:name"  as shown.
What change can satisfy "to-file" so that I can re-write the file on the server and alter end-of-line characters Huh

#!rebol.exe -cs
REBOL []
print {Content-Type: text/html}  ;-- Required Page Header
print " "
print " "
cgi: make object! decode-cgi system/options/cgi/query-string
;file: to-file   cgi/:name
;write file read file
foreach name next first cgi [print [name "is" <B> cgi/:name </B><P>]]
print [</body><html>]
Logged
PeterWood
Newbie
*
Offline Offline

Posts: 34


View Profile
Re: "picking" a value from the CGI object...
« Reply #1 on: June 05, 2007, 10:49:34 AM »

John

Try

Code:
file: to file! cgi/name

You don't need to use the get word :name; Rebol evaluates cgi/name to be the value contained in name. [I don't think you can use the  : get word notation in a path.]

You might find it worth the time to read Sunanda's article on reading cgi data safely - http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=x60w. I did.
Logged
jfdutcher
Jr. Member
**
Offline Offline

Posts: 95


View Profile
Re: "picking" a value from the CGI object...
« Reply #2 on: June 05, 2007, 05:41:06 PM »

Thanks for the input....in thinking about the error of my ways today I came up with this change to the script....which works fine now.......as you would have guessed.

John D.

#!rebol.exe -cs
REBOL []
print {Content-Type: text/html}  ;-- Required Page Header
print " "
print " "
cgi: make object! decode-cgi system/options/cgi/query-string
file: to-file  cgi/filename
write file read file
print ["Filename: " <B> cgi/filename </B> "was rewritten"<P>]
print [</body><html>]
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: "picking" a value from the CGI object...
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2008, 09:23:10 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2295 Posts in 593 Topics by 3763 Members
Latest Member: svolika

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc