UNIX help?
Sadhunathan Nadesan
sadhu at castandcrew.com
Thu Jun 26 10:36:00 EDT 2003
| 5. UNIX help? (Richard MacLemale)
Perhaps it would be instructive to see a cgi script that is working?
BTW, this is an old one, I now collect the post data in a loop, since
we found we'd sometimes not get all the data. However, this should work
for a form that is not too long.
You will of course have to replace my qmail command with a sendmail
equivalent.
Sadhu
#!/usr/local/bin/mc
#*************************************************************************
#
# -=< Web Stuff >=-
#
# Program name: form.mt
# Version number: 1.0
# Author: SN
# Date: 10/9/01
# Description: Process web form messages
#
#
#****************************************************************************
on startup
-- collect the information from the form
read from stdin until empty
put it into url "file:/tmp/itdata.txt"
put urlDecode (it) into formdata
split formdata by "&" and "="
-- email the form contents to the user
put formdata into url "file:/tmp/formdata.txt"
put "/var/qmail/bin/qmail-inject '$EMAIL' < /tmp/formdata.txt" \
into command_string
replace "$EMAIL" with formdata["email"] in command_string
set shellCommand to "/bin/sh"
put shell(command_string)
-- respond to the user
put "Content-Type: text/plain" & cr & cr
put "Your information is below" & cr
put command_string
put keys(formdata) into keywords
repeat for each line this_item in keywords
put this_item && "=" && formdata[this_item] & cr
end repeat
end startup
More information about the metacard
mailing list