[REBOL] cgi path
From: kpeters::vu-ware::com at: 7-Aug-2005 14:50
Thanks Sunanda - that was actually the first thing I tried and it didn't
work initially. Must have screwed up the upload!?!
Didn't know about clean-path which comes in handy - lots to learn!
Using the script below, it now finds and displays the files. But all
relative links from the files displayed via the Rebol script (to images
& css scripts) are broken.
Such as: <img src="images/header.png" alt="ZooBase Logo" width="750"
height="90" border="0"> and "href="zbstyles.css"
I have tried playing with change-dir in the script and changing the
links in my html files to something like: "../httpdocs/images/header.png
- all to no avail!
What do I need to do to make this work?
Thanks again,
Kai
#!/home/httpd/vhosts/<my domain>/cgi-bin/rebol -cs
REBOL []
cgiparams: system/options/cgi/query-string
print "Content-type: text/html^/"
destpage: first parse/all cgiparams "&"
destpage: second parse/all destpage "="
;****************************************************
; does the replace make it safe enough?
;****************************************************
filename: rejoin [ %../httpdocs/ replace/all destpage "/" "@" ".html" ]
either exists? filename [
html: read/lines filename
print html
][
print ["couldn't find " filename clean-path filename]
]