#!/bin/bash # EncTurn1.cgi # encode FormTurn1.html to code echo "$REMOTE_ADDR" >> hitlist echo "Content-type: text/html" echo "" echo "<HTML><HEAD></HEAD><BODY><PRE>" # is it post ??? if [ "$REQUEST_METHOD" = "POST" ]; then QUERY_STRING=`cat ` fi #echo "$QUERY_STRING" >> /tmp/ET1.txt # USE sed TO REPLACE & WITH TAB LINE=`echo $QUERY_STRING | sed 's/&/ /g'` for LOOP in $LINE do NAME=`echo $LOOP | sed 's/=/ /g' | awk '{print $1}'` # replace % with \x in the string and replace all + with spaces TYPE=`echo $LOOP | sed 's/=/ /g' | awk '{print $2}' | sed -e 's/%\(\)/\\\x/g' | sed 's/+/ /g'` # USE printf IT DOES ALL THE HEX CONVERSION FOR YOU #display line # printf "${NAME}=${TYPE}\n" VARS=`printf "${NAME}=\\${TYPE}\n"` #load the value of VARS into the script eval `printf $VARS` done #(PCALL 9832,P150=0,P154=18,P155=19,P152=8) if [ "$PCALL9832P150" = "" ]; then PCALL9832P150="0" fi if [ "$PCALL9832P154" = "" ]; then PCALL9832P154="0" fi if [ "$PCALL9832P155" = "" ]; then PCALL9832P155="0" fi if [ "$PCALL9832P152" = "" ]; then PCALL9832P152="8" else PCALL9832P152="9" fi #(PCALL 9901,X=1,Z=2,W=3,R=4,Q=5,D=6,E=7,M=0,C=13, if [ "$PCALL9901X" = "" ]; then PCALL9901X="0" fi if [ "$PCALL9901Z" = "" ]; then PCALL9901Z="0" fi if [ "$PCALL9901W" = "" ]; then PCALL9901W="0" fi if [ "$PCALL9901R" = "" ]; then PCALL9901R="0" fi if [ "$PCALL9901Q" = "" ]; then PCALL9901Q="0" fi if [ "$PCALL9901D" = "" ]; then PCALL9901D="0" fi if [ "$PCALL9901E" = "" ]; then PCALL9901E="0" fi if [ "$PCALL9901M" = "" ]; then PCALL9901M="0" fi if [ "$PCALL9901C" = "" ]; then PCALL9901C="0" fi #F=9,S=10,T=11,H=14,U=15,V=16,G=1,Y=0,N=8,J=12,P=17) if [ "$PCALL9901F" = "" ]; then PCALL9901F="0" fi if [ "$PCALL9901S" = "" ]; then PCALL9901S="0" fi if [ "$PCALL9901T" = "" ]; then PCALL9901T="0" fi if [ "$PCALL9901H" = "" ]; then PCALL9901H="0" fi if [ "$PCALL9901U" = "" ]; then PCALL9901U="0" fi if [ "$PCALL9901V" = "" ]; then PCALL9901V="0" fi if [ "$PCALL9901G" = "" ]; then PCALL9901G="0" fi if [ "$PCALL9901Y" = "" ]; then PCALL9901Y="0" fi if [ "$PCALL9901N" = "" ]; then PCALL9901N="0" fi #J=12,P=17) # J takes on the value of T if J is undefined if [ "$PCALL9901J" = "" ]; then PCALL9901J="$PCALL9901T" fi # V takes on the value of P if V is undefined if [ "$PCALL9901P" = "" ]; then PCALL9901P="$PCALL9901V" fi echo "(PCALL 9832,P150=$PCALL9832P150,P154=$PCALL9832P154,P155=$PCALL9832P155,P152=$PCALL9832P152)" echo -ne "(PCALL 9901,X=$PCALL9901X,Z=$PCALL9901Z,W=$PCALL9901W,R=$PCALL9901R,Q=$PCALL9901Q,D=$PCALL9901D,E=$PCALL9901E,M=$PCALL9901M,C=$PCALL9901C," echo "F=$PCALL9901F,S=$PCALL9901S,T=$PCALL9901T,H=$PCALL9901H,U=$PCALL9901U,V=$PCALL9901V,G=$PCALL9901G,Y=$PCALL9901Y,N=$PCALL9901N,J=$PCALL9901J,P=$PCALL9901P)" echo "</PRE></BODY></HTML>"