Index: work/feature_poll/pcb-rnd-poll.cgi =================================================================== --- work/feature_poll/pcb-rnd-poll.cgi (revision 1588) +++ work/feature_poll/pcb-rnd-poll.cgi (revision 1589) @@ -41,6 +41,36 @@ # someone is a tester if choice is < $tester_thrs tester_thrs=2 +url_decode() +{ +awk ' + function cd(n) + { + chr=sprintf("%c", n); + if (chr == "&") + chr = "\\&" + code="%" sprintf("%02x", n); + CODE[tolower(code)] = chr; + CODE[toupper(code)] = chr; + } + + BEGIN { + for(n = 1; n < 256; n++) + cd(n); + } + + { + tmp = $0; + gsub("[+]", " ", tmp); + for(c in CODE) { + gsub(c, CODE[c], tmp) + } + print tmp + } +' +} + + fix_ltgt() { sed "s//\>/g" @@ -290,24 +320,27 @@ then error "you got the captcha wrong, please try again." fi + + export QS_email=`echo "$QS_email" | url_decode` + if test -z "$QS_email" then 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._-"` + email=`echo "$QS_email" | tr -d -c "@a-zA-Z0-9._-"` if test "$email" != "$QS_email" then - error "invalid character in email the email address." + error "invalid character in email the email address" fi - cfn=$db/cookies/$QS_email + cfn="$db/cookies/$QS_email" cookie=`cat $cfn` if test -z "$cookie" then if test ! -z "$QS_cookie" then - echo "$QS_cookie" | md5sum > cfn + echo "$QS_cookie" | md5sum > $cfn fi else uck=`echo "$QS_cookie" | md5sum` @@ -317,6 +350,8 @@ fi fi + export SES_EMAIL="$email" + cmd_list }