Raymond E. Griffith wrote/ schreef:
> on 6/06/2001 12:01 AM, "Sjoerd Op 't Land" <[EMAIL PROTECTED]> was very
> helpful
>
> Thank you. This is helpful. But I am going to expose my great ignorance here
> (some things I do mighty well, but this is not one of them).
>
> This is an .mt script, right? So what is involved in putting up a MetaCard
> cgi? Will I have to have a version of MetaCard on the server? How do I
> format the MetaCard stack that contains the cgi script?
CGI works like this:
- web client sends some data from (e.g.) his Internet browser
- server processes it in some way (e.g. a .mt script)
- web client receives the output from this process
So, a .mt script is just one of the (very) many ways to process the data. A
.mt script looks like this:
----------------------------------------------------------------------------
#!/usr/bin/mc
-- so that the server knows that this script has to be executed
-- with MetaCard
on startup
-- everything between 'on startUp' and 'end startUp' will be executed
# first make an array qParameter with all the arguments
# as key
set itemdel to "="
put replaceText($QUERY_STRING,"&",return) into tQuery
repeat with i = 1 to the number of lines in tQuery
put urlDecode(item 2 of line i of tQuery) into qParameter[item 1 of line
i of tQuery]
end repeat
-- this is just a handy snippet to extract the arguments from the query
-- string. Example:
-- $QUERY_STRING = "name=Sjoerd%20Op%20%35t%20Land&age=14&vote=4"
-- result: qParameter["name"] = "Sjoerd Op 't Land"
-- qParameter["age"] = "14"
-- qParameter["vote"] = "4"
-- generate the content, you can put whatever you want to do here
put "This is a test" into buffer
-- write minimal set of HTTP headers to stdout
-- (if you use 'put' here without a destination, it goes to the 'stdout'
-- i.e. the web client)
put "Content-Type: text/plain" & cr
-- use "text/html" if you want to output HTML, or
-- "image/jpeg" if you want to output a JPG file for example
put "Content-Length:" && the length of buffer & cr & cr
put buffer
end startup
----------------------------------------------------------------------------
You need to have MC installed at the server. Make a text file with your
script (like the above), and upload it to the server. Don't forget to set
the permissions to "755", use chmod.
If you don't know how to configure all this, and just want to test some CGI
scripts, go to http://www.mctools.org/ and create a free MT CGI account.
Read the instructions!
> Now at the moment, I am using Tripod for my server. That will change, later,
> but for right now it is available and I need to use it.
>
> All this is very new to me, but absolutely necessary for the person I am
> working with.
>
> Thanks
>
> Raymond
Hope this helps,
Sjoerd
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.