#!/bin/sh # This simple shell script will take the arguments passed in, # and print them out cgiutils -ct text/html eval `cgiparse -init` echo '' echo '' echo '
';
echo 'This is an example of a CGI script which uses the '
echo 'cgiutils
and cgiparse
'
echo 'functions to create a valid HTTP header and parse forms data,'
echo 'respectively.'
echo 'The cgiutils
program is used to create'
echo ' a set of HTTP'
echo 'headers for the CGI script output.'
echo '
'
echo 'The cgiparse
program is used to extract'
echo ' data submitted as HTTP GET or POST requests from'
echo 'forms The program parses variables from the CGI QUERY_STRING'
echo 'environment variable.'
echo 'The cgiparse
program is useful for'
echo 'extracting information such as the value of'
echo 'a specific form field or the number of unique fields submitted'
echo 'from a form.';
echo 'This information can then be processed by CGI scripts in'
echo 'performing their intended functions.'
echo '
'
echo 'Some examples of how the cgiparse
program'
echo ' can be used are shown below'
echo '
cgiparse'
echo '
'
echo 'cgiparse
'echo 'command. The -form option'
echo 'will parse the QUERY_STRING as a form request'
echo 'and output the fields as a string of variables.'
echo ''
echo 'The format of the cgiparse
command is'
echo ' cgiparse -form
.' ;
echo '
'
echo ''
cgiparse -form
echo '
'
echo '
cgiparse
'
echo 'cgiparse'
echo '
'
echo 'command to query the values of specific'
echo 'fields parsed from the QUERY_STRING.'
echo ''
echo 'The format of the cgiparse
command is'
echo 'cgiparse -value fieldname'
echo '
'
echo '
'
echo 'Value for variable 1 = '
cgiparse -value var1
echo '
'
echo 'Value for variable 2 = '
cgiparse -value var2
echo '
'
echo 'Value for variable 3 = '
cgiparse -value var3
echo '
'
echo 'Value for variable 4 = '
cgiparse -value var4
echo '
'
echo 'Value for variable 5 = '
cgiparse -value var5
echo '
'
echo 'Value for variable 6 = '
cgiparse -value var6
echo '
'
echo '
cgiparse
cgiparse
function can also be used to'
echo 'determine the number of unique fields that are submitted with'
echo 'a form.'
echo ''
echo 'The format of the cgiparse
command is'
echo 'cgiparse -form -count
.'
echo '
'
echo 'Number of unique fields = '
cgiparse -form -count
echo '
'
echo '