I'm writing a CGI to install/update XOOPS cores/modules.
It means you will be free from "uploading/overwriting massive files via ftp" or "chmod some directories before installing".
There are too many shared web servers like:
PHP: apache module (run as apache/nobody)
CGI: suExec (run as the file's owner)
Such users must be lucky
But, I don't write the CGI by perl but bash, because perl can cause some errors depending on modules/environments.
These are Tips/Problems to write CGI by bash.
- echo HTTP response headers
Without HTTP headers, the CGI returns 500 error
- how to get requests
GET variables: parse $QUERY_STRING
POST variables: parse <stdin>
This is a sample of the parser.
query="$QUERY_STRING&"
until [ -z "$query" ] ; do
k_v=${query%%&*}
query=${query#*&}
key=${k_v%%=*}
value=${k_v#*=}
done