Important: Versions before 11/06/1997 have a security bug. If you downloaded this program before that date, download the current version, and substitute all your copies with this one.This page presents a little program that will help you processing form data in a CGI shell script. If you're unfamiliar with Perl and don't want to write a bulky C program just for a small CGI job, shell script CGI programming may be an option. You receive the form values straight into your shell environment (the names prefixed with "FORM_"), where you can then access them just like other shell variables.
I have a different page with the same title, where I present a shell script to do the same job of extracting form data and feeding it to your script. However, this C program is much faster and easier to use.
/A=trash), it is processed as well.
proccgito a location of your choice, where it is accessible to your CGI scripts.
eval "`proccgi $*`"In some cases, you might need to give the full pathname if it's not found automatically. After this call, you have everything in your shell.
Be careful to quote the call to proccgi, else shell expansion will take place, potentially opening security leaks.
<form action="http://our-server/cgi-stuff/mailer" method="post"> <dl> <dt> Your Email <dd> <input name="email" size="50"> <dt> Filename <dd> <input name="file" size="50"> </dl> <input type="submit" value="Submit"> </form>
#!/bin/sh eval "`procgi $*`" mail $FORM_email < $FORM_file cat - << \END echo Content-type: text/plain echo echo done. ENDAs you can see, after the call to
proccgi, the email address from the form is stored in the shell variable $FORM_email, and the file name is in $FORM_file.
The script may be freely used and distributed at no charge provided that the copyright notice remains at its top.