Listing 2
#!/bin/sh
# - echo.sh
if [ "REQUEST_METHOD" = "POST" ]; then
read QUERY_STRING
fi
echo "Content-type: text/html"
echo ""
echo "<HEAD>"
echo "<TITLE>Echo Results</TITLE>"
echo "</HEAD>"
echo "<BODY>"
echo "<HR>"
echo "<B>QUERY_STRING=</B>"$QUERY_STRING
echo "<HR>"
echo "<H2>Environment Variables</H2>"
echo "<B>REQUEST_METHOD=</B>"$REQUEST_METHOD"<BR>"
echo "<B>REMOTE_HOST=</B>"$REMOTE_HOST"<BR>"
echo "<B>REMOTE_ADDR=</B>"$REMOTE_ADDR"<BR>"
echo "<B>CONTENT_LENGTH=</B>"$CONTENT_LENGTH"<BR>"
echo "<HR>"
echo "<H2>Decoded Query</H2>"
#Split the encoded data into name=value pairs
OPTS='echo $QUERY_STRING | sed 's/&/ /g''
#Decode the form data
echo "\<OL>"
for opt in $OPTS; do
NAME='echo $opt | sed 's/=/ /g' | awk '{print $1}''
VALUE='echo $opt | sed s/=/ /g' | awl '{print $1}; | sed 's,%,\\\x,g' | sed 's/+/ /g''
printf "<LI><B>$NAME:</B>$VALUE"
done
echo "</OL>"
echo "</BODY>"