Index: work/feature_poll/pcb-rnd-poll.cgi
===================================================================
--- work/feature_poll/pcb-rnd-poll.cgi (revision 1585)
+++ work/feature_poll/pcb-rnd-poll.cgi (revision 1586)
@@ -4,8 +4,17 @@
db=db
sesdir=$db/session
CGI="/cgi-bin/pcb-rnd-poll.cgi"
-spiral=/home/igor2/C/c_exp/captcha/src/captcha/main
+if test -z "$srcdir"
+then
+ srcdir="src"
+fi
+
+if test -z "$spiral"
+then
+ spiral=/home/igor2/C/c_exp/captcha/src/captcha/main
+fi
+
session_fields="SES_EMAIL SES_CAPTCHA"
# how much each choice is worth when calculating scores
@@ -105,7 +114,7 @@
echo "
"
if test -f $name/icon.png
then
- echo ""
+ echo ""
else
echo " "
fi
@@ -251,7 +260,7 @@
ses_load()
{
local key val
- export QS_SID=`echo $QS_SID | tr -d -c "[a-fA-F0-9]"`
+ 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)"
@@ -276,6 +285,8 @@
cmd_try_enter()
{
+ local cookie email cfn
+
export subs_current="entering..."
if test "$QS_captcha" != "$SES_CAPTCHA"
then
@@ -282,6 +293,35 @@
echo "Error: you got the captcha wrong, please try again."
exit
fi
+ if test -z "$QS_email"
+ then
+ echo "Error: you need to provide an email address to vote, please try again."
+ exit
+ 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
+ fi
+
+ cfn=$db/cookies/$QS_email
+ cookie=`cat $cfn`
+ if test -z "$cookie"
+ then
+ if test ! -z "$QS_cookie"
+ then
+ echo "$QS_cookie" | md5sum > cfn
+ fi
+ else
+ if test "$QS_cookie" != "$cookie"
+ then
+ echo "Error: wrong cookie"
+ exit
+ fi
+ fi
+
cmd_list
}
Index: work/feature_poll/src/enter.html
===================================================================
--- work/feature_poll/src/enter.html (revision 1585)
+++ work/feature_poll/src/enter.html (revision 1586)
@@ -2,7 +2,8 @@
Enter voting mode
-This site is registrationless. Each user needs to vote with his/her unique
+This site doesn't require a full registration, even "password" (cookie) is
+optional. Each user needs to vote with his/her unique
email address (one address per user allowed). Privacy policy: I will use
your email address only to:
@@ -12,18 +13,27 @@
Drop me a mail to pcb-rnd (at) igor2.repo.hu if you want your email address
(and votes) removed.
+Optional cookie: first time the system sees an email address it saves
+the hash of the cookie provided. Later on if the user returns, the same
+cookie must be entered. If no cookie is provided, the email address is
+not remembered and the system will allow the user to log in next time
+without a cookie. Once a cookie is set, it can not be changed. If you
+want to use an email address widely known, you should use a cookie. Never
+use sensitive password in the cookie, it travels as plain text, unencrypted!
+
Once you "logged in" with your email address below, you are free to set or
change your vote on any of the features. Features with higher scores and
active test-offers have higher chance to get implemented, but at the end
it is always the coder's choice which feature gets his time/attention.
-
@
|