diff --git a/vote/Makefile.am b/vote/Makefile.am index e33c403..71bb8ef 100644 --- a/vote/Makefile.am +++ b/vote/Makefile.am @@ -8,6 +8,7 @@ page_SCRIPTS = \ results.php \ votes.php \ vote.php \ + verify.php \ overview.html \ blt.php diff --git a/vote/include/election-sql.php b/vote/include/election-sql.php index a7336a1..a3d6629 100644 --- a/vote/include/election-sql.php +++ b/vote/include/election-sql.php @@ -150,6 +150,24 @@ function elec_verify_email_tmp_token ($handle, $election_id, $email, $tmp_token) return (mysql_result ($result, 0, 0) == 1); } +function elec_verify_voted_token ($handle, $verify_token) { + global $anon_tokens_table; + + if ($handle === FALSE) + return FALSE; + + $escaped_verify_token = mysql_real_escape_string ($verify_token, $handle); + + $query = "SELECT id FROM " . $anon_tokens_table; + $query .= " WHERE anon_token = '". $escaped_verify_token."'"; + + $result = mysql_query ($query, $handle); + if (!$result) + return 0; + + return mysql_result ($result, 0, 0); +} + function elec_choices_get ($handle, $election_id) { global $choices_table; diff --git a/vote/verify.wml b/vote/verify.wml new file mode 100644 index 0000000..a9be761 --- /dev/null +++ b/vote/verify.wml @@ -0,0 +1,81 @@ + + +
+ +Please enter your ballot verification token.
\n"; + echo "\n"; +} else { + $votes = elec_get_votes_for_anon_token ($handle, $anon_token_id); + echo "If you don't understand the error, you should probably contact the $committee_name, which can be reached at $committee_email.
\n"; +} + +if (isset ($handle)) + elec_sql_close ($handle); + +?>