#!/bin/sh
# plot_graph.cgi 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"`\""
#disable next line for Sweex - keep for Slug
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 web_page_top.html which is the first part of the html page
#use this for all projects - some browsers reject other structures
cat webpage_top.html
. $inc
#get the system date and time and present them in a new format
datestring=`date`
dateonly=`expr substr $datestring 1 10`
timeonly=`expr substr $datestring 12 8` with seconds display
timeonly=`expr substr $datestring 12 5`
yearonly=`expr substr $datestring 25 4`
timedate=$timeonly" "$dateonly
echo "
"
echo "
"$timedate
echo "
NSLU2 uptime: `cat /proc/uptime | cut -d ' ' -f 1` seconds.
"
# now finish the html
cat webpage_bottom.html