#!/bin/sh
# Decode query string
# (Retrieve the strings sent from the remote browser)
IFS="&"
for QUERY_PARTS in $QUERY_STRING; do
QKEY="`echo $QUERY_PARTS | cut -d '=' -f 1`"
QVAL="`echo $QUERY_PARTS | cut -d '=' -f 2`"
eval "`httpd -d "$QKEY"`=\"`httpd -d "$QVAL"`\""
eval "$QKEY=\"$QVAL\""
done
# when the page is first opened load the text from pg-default.sh
# the pg-xxxxx.sh page gets strings from the web page like ->
# index.cgi?page=xxxxxsend&string=HARRY
# or even index.cgi?page=xxxxxsend&string1=HARRY&string2=MARY
# (and as many strings as you want)
# so the values of both page and string are sent to this script
# thus if page=xxxxx the script we run will be pg-xxxxx.sh
# and it will have the strings from the web page available to use
# has the variable page been given a value?
if [ -e "pg-$page.sh" ]; then
inc="./pg-$page.sh"
# if not then show the default text
else
inc="./pg-default.sh"
page="default"
fi
#send xxxxx.html which is the first part of the html page
cat xxxxx.html
echo ""
. $inc
echo ""
#you can add shell command line commands here such as-
echo "Router uptime: `cat /proc/uptime | cut -d ' ' -f 1` seconds.
"
# now finish the html
echo "