Vote Verification
\n";
$step = 0;
}
$verify_token = "";
if (($_POST["verify_token"])) {
$verify_token = $_POST["verify_token"];
}
$anon_token_id = elec_verify_voted_token ($handle, $verify_token);
if ($verify_token && $anon_token_id <= 0) {
$error .= "The vote verification token provided does not appear in the votes database. Please check that you entered it correctly.
\n";
}
if (!$verify_token || $error) {
echo "Verify your ballot
\n";
echo "Please enter your ballot verification token.
\n";
echo "\n";
} else {
$votes = elec_get_votes_for_anon_token ($handle, $anon_token_id);
$choices = elec_choices_get_by_anon_token_id($handle, $anon_token_id);
if ($choices === FALSE) {
$error .= "The ".htmlspecialchars(elec_election_get_type ($election))." is not properly set up.\n";
}
$choices_name = array ();
foreach ($choices as $choice) {
$choices_name[$choice["id"]] = $choice["choice"];
}
if ($votes === FALSE) {
echo "Can not access votes
for this anonymous token.";
$error .= "Can not get votes for anonymous token ".htmlspecialchars($anon_token["anon_token"])."
\n";
} else if (count ($votes) == 0) {
echo "This voter chose to vote for
none of the possible choices.";
} else {
echo "Vote token, $verify_token , recorded votes in the following order:";
echo "";
foreach ($votes as $vote) {
if (array_key_exists ($vote["choice_id"], $choices_name))
echo "- ".htmlspecialchars($votes["preference"])." ".htmlspecialchars($choices_name[$vote["choice_id"]])."
\n";
else {
echo "- Unknown value (".htmlspecialchars($vote["choice_id"]).")
\n";
$error .= "There was an unkown vote for anonymous token ".htmlspecialchars($anon_token["anon_token"]).": ".htmlspecialchars($vote["choice_id"])."
\n";
}
}
echo "
";
}
echo "\n";
echo "\n";
echo "\n";
}
global $committee_name;
global $committee_email;
if (isset ($error) && $error != "") {
echo "".$error."
\n";;
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);
?>