# qua.cgi - bash voting machine # webshells.com/labor/ocaw/index5.htm by J. Doug Ohmans # Copyright (C) 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation. # # Political Poll # # Logo # Vote #

Who Do You Tend To Agree With Politically?

#
# Democrats # Republicans # Labor Party # Other

# # View #

#


#
# Home
# # #!/usr/bin/bash echo Content-type: text/html echo cat << eof Political Poll

Political Poll

eof lastip=`cat lastip` tmpdem=`cat totdem` tmprep=`cat totrep` tmplab=`cat totlab` tmpoth=`cat tototh` IFS='=' set -- $QUERY_STRING party="$2" set -- $REMOTE_ADDR tmplst="$1" if [ $tmplst != "$lastip" ]; then if [ $party ]; then if [ $party = "1" ]; then let "tmpdem = tmpdem + 1" echo $tmpdem > totdem elif [ $party = "2" ]; then let "tmprep = tmprep + 1" echo $tmprep > totrep elif [ $party = "3" ]; then let "tmplab = tmplab + 1" echo $tmplab > totlab elif [ $party = "4" ]; then let "tmpoth = tmpoth + 1" echo $tmpoth > tototh fi else echo "You don't have a preference?

" echo "Go Back" exit fi fi let "total = tmpdem + tmprep + tmplab + tmpoth" let "pctdem = tmpdem * 100 / total" let "pctrep = tmprep * 100 / total" let "pctlab = tmplab * 100 / total" let "pctoth = 100 - pctdem - pctrep - pctlab" echo "

$total visitors have voted. Of these:

" echo "$pctdem percent ($tmpdem) agree with the Democrats.
" echo "$pctrep percent ($tmprep) agree with the Republicans.
" echo "$pctlab percent ($tmplab) agree with the Labor Party.
" echo "$pctoth percent ($tmpoth) have other political views.
" if [ $party != "5" ]; then if [ $tmplst = "$lastip" ]; then echo "

Please vote only once!

" else echo $tmplst > lastip fi fi cat << eof


eof