Accessing other stacks in LibCGI
Jan Schenkel
janschenkel at yahoo.com
Fri Aug 20 01:52:42 EDT 2004
--- Rodney Tamblyn <rodney at oceanbrowser.com> wrote:
> Hi Terry,
>
> You *think* (you'll need to check this) you can
> access data in custom
> properties of stacks, but not fields, when the stack
> is accessed by the
> command line engine. e.g. you can start using a
> stack, and execute a
> function that may (for example) retrieve data stored
> in a custom
> property of the stack, but you cannot navigate to a
> card, get a field
> etc.
>
> ~ Rodney
>
Actually, why not just go to the right card in the
stack and execute the function ? I made a simple test
stack with a single bakcground field "Memo" and the
following cgi-scripts to test :
1. newmemo.mt
--
#!revolution
on startUp
open stack "smemo.rev"
go last card
create card
put "I made this with the cgi-engine," && \
the internet date && "!" into field "memo"
save stack "smemo.rev"
close stack "smemo.rev"
put "Added 1 card" into tBuffer
put "Content-Type: text/plain" & cr
put "Content-Length:" && length(tBuffer) & cr & cr
put tBuffer
end startUp
--
2. showmemo.mt
--
#!revolution
on startUp
put $QUERY_STRING into tQuery
split tQuery using "&" and "="
put tQuery["number"] into tCardNumber
open stack "smemo.rev"
go card tCardNumber
put "Content of 'memo' field:" & return & \
field "memo" into tBuffer
close stack "smemo"
put "Content-Type: text/plain" & cr
put "Content-Length:" && length(tBuffer) & cr & cr
put tBuffer
end startUp
--
I triggered newmemo a couple of times, checked the
content with Revolution to make sure there was data in
the stack.
Then I wanted to see if the cgi-engine could get the
content of the field from card 3 with:
http://localhost/cgi-bin/showmemo.mt?number=3
And I got the correct result.
[And before any of the security experts say anything,
this is running on a separate box on my local network
so security is not an issue for these tests]
Hope this helped,
Jan Schenkel
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
More information about the use-livecode
mailing list