Index: pcb-rnd-poll.cgi
===================================================================
--- pcb-rnd-poll.cgi (revision 1587)
+++ pcb-rnd-poll.cgi (revision 1588)
@@ -46,14 +46,15 @@
sed "s/\</g;s/>/\>/g"
}
-qs=`echo "$QUERY_STRING" | tr "&" "\n"`
+error()
+{
+ echo "Content-type: text/html"
+ echo ""
+ echo "
Error
"
+ echo "$@"
+ exit 0
+}
-for n in $qs
-do
- exp="QS_$n"
- export $exp
-done
-
get_score()
{
bn=`basename $1`
@@ -153,8 +154,7 @@
{
if test -z "$SES_CAPTCHA"
then
- echo "INTERNAL ERROR generating the captcha"
- return
+ error "INTERNAL ERROR generating the captcha"
fi
echo " ASCII version for the console user"
echo " | bitmap version for the GUI user"
@@ -242,8 +242,7 @@
fi
done
- echo "Error creating a session"
- exit 0
+ error "creating a session"
}
ses_save()
@@ -263,8 +262,7 @@
export QS_SID=`echo $QS_SID | tr -d -c "a-fA-F0-9"`
if test ! -f "$sesdir/$QS_SID"
then
- echo "Error: invalid SID (session id)"
- exit
+ error "invalid SID (session id)"
fi
while read key val
do
@@ -290,20 +288,17 @@
export subs_current="entering..."
if test "$QS_captcha" != "$SES_CAPTCHA"
then
- echo "Error: you got the captcha wrong, please try again."
- exit
+ error "you got the captcha wrong, please try again."
fi
if test -z "$QS_email"
then
- echo "Error: you need to provide an email address to vote, please try again."
- exit
+ error "you need to provide an email address to vote, please try again."
fi
email=`echo $QS_email | tr -d -c "@a-fA-F0-9._-"`
if test "$email" != "$QS_email"
then
- echo "Error: invalid character in email the email address."
- exit
+ error "invalid character in email the email address."
fi
cfn=$db/cookies/$QS_email
@@ -318,8 +313,7 @@
uck=`echo "$QS_cookie" | md5sum`
if test "$uck" != "$cookie"
then
- echo "Error: wrong cookie"
- exit
+ error "wrong cookie"
fi
fi
@@ -355,6 +349,17 @@
########## main ############
+
+qs=`echo "$QUERY_STRING" | tr "&" "\n"`
+
+for n in $qs
+do
+ exp="QS_$n"
+ export $exp
+done
+
+
+
if test ! -z "$QS_SID"
then
ses_load
|