#!/bin/sh
# derived from index.cgi
#Decode query string
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 is addressed 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=rs232send the script we run will be pg-rs232send.sh
# 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
echo "Content-type: text/html"
echo
#send beeper1.html which is the first part of the html page
cat beeper1.html
echo ""
. $inc
echo ""
echo "Router uptime: `cat /proc/uptime | cut -d ' ' -f 1` seconds.
"
# now finish the html
echo "