#!/bin/sh fbdata="/u/faculty/dick/fb.dat" # path name of file writable by 'nobody' # $fbdata records a numeric key and a mailer command to send data. fbupdate="/u/faculty/dick/bin/fbup" # compiled file update program at="csusb.edu" # address of faculty host or domain MX export fbdata at echo Content-type: text/html echo if [ x"$REQUEST_METHOD" = xPOST ] then /u/faculty/dick/bin/unpost $CONTENT_LENGTH | tr '&' ' ' | /u/faculty/dick/bin/url2lf | /u/faculty/dick/bin/urlunencode | ( # start of posted data read l1; read l2; read l3 id=`expr "$l1" : 'id=\([a-zA-Z0-9.]*\)'|awk '{print substr($0,1,20);}'` subject=`expr "$l2" : 'subject=\(.*\)'|awk '{print substr($0,1,80);}'` question=`expr "$l3" : 'question=\(.*\)'` # just the first line command="mailx -s \"$subject\" $id@$at" tmp="/tmp/mkfb$$" # temporary files have name $tmp* tmp1="$tmp"a # questions input # tmp2="$tmp"b # the form to be output echo $question >$tmp1 && trap "rm $tmp*" 1 2 3 0 cat >>$tmp1 # end of posted data key=`$fbupdate $fbdata "$command"` #------------------------ # if [ -s $fbdata ] # then lastkey=`sed -n '$s/\([0-9]*\) .*$/\1/p' $fbdata` # key=`expr 1 + $lastkey` # else # key=1 # fi # echo "$key" "$command" >>$fbdata #------------------------ export key nqns=`wc -l $tmp1`; export nqns nqns=`expr "$nqns" : " *\([0-9]*\)"` hi=`expr $nqns + 3` # number of rows in form # echo nqns=$nqns, hi=$hi export hi echo "Feedback to $id@$at about $subject" echo "

Anonymous Feedback

" echo "Please edit the box below and then send your comment.

" echo "

" echo " " echo "

" echo "
" echo "
" echo "

" echo "" ) else echo REQUEST_METHOD must be POST. fi