update
This commit is contained in:
50
vote.php
50
vote.php
@ -8,6 +8,30 @@ if (array_key_exists("id", $_GET)) $idVotant = $_GET["id"];
|
||||
if (array_key_exists("v", $_GET)) $votation = $_GET["v"];
|
||||
if (array_key_exists("vote", $_GET)) $vote = $_GET["vote"];
|
||||
|
||||
function voter($idVotant, $votation, $vote)
|
||||
{
|
||||
foreach ($vote as $key => $value)
|
||||
{
|
||||
$result = $db->vote($votation, $idVotant, $key, $value );
|
||||
if ($result == '')
|
||||
{
|
||||
$idVote = array_search($key, array_column($listeVotes, 'id'));
|
||||
echo '<h4>' . $listeVotes[$idVote]['libelle'] . ' : vote pris en compte</h4>' .EOLH;
|
||||
log_write($idVotant . ' a voté');
|
||||
}else
|
||||
{
|
||||
print ('<h4>ERREUR: vote non pris en compte</h4>') . EOLH;
|
||||
if (strpos($result, 'Duplicate') !== false)
|
||||
{
|
||||
print ("<h5>L'erreur est normale si vous avez essayé de recharger la page");
|
||||
}
|
||||
print("<h5>Adressez-vous aux responsables de l'association, ils ont déjà été averti de l'erreur</h5>" . EOLH);
|
||||
log_error( "vote non pris en compte : idVotant=$idVotant, id_Votation=$votation, key=$key, value=$value");
|
||||
}
|
||||
//echo "$key => $value";
|
||||
}
|
||||
}
|
||||
|
||||
$db = new db();
|
||||
|
||||
print('<br><br>
|
||||
@ -23,26 +47,18 @@ $query = 'SELECT * FROM liste_votes WHERE idVotation="' . $db->protect( $votatio
|
||||
$result = $db->query($query);
|
||||
$listeVotes = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
foreach ($vote as $key => $value)
|
||||
{
|
||||
$result = $db->vote($votation, $idVotant, $key, $value );
|
||||
voter($idVotant, $votation, $vote);
|
||||
|
||||
if ($result == '')
|
||||
$query = "SELECT idprocurant FROM procurations WHERE idvotant='" . $db->protect(idVotant) . "' AND idvotation=" . $db->protect(idVotation);
|
||||
$result = $db->query($query);
|
||||
$listProcurants = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
if (count($listProcurants) != 0)
|
||||
{
|
||||
foreach($listProcurants as $procurant)
|
||||
{
|
||||
$idVote = array_search($key, array_column($listeVotes, 'id'));
|
||||
echo '<h4>' . $listeVotes[$idVote]['libelle'] . ' : vote pris en compte</h4>' .EOLH;
|
||||
log_write($idVotant . ' a voté');
|
||||
}else
|
||||
{
|
||||
print ('<h4>ERREUR: vote non pris en compte</h4>') . EOLH;
|
||||
if (strpos($result, 'Duplicate') !== false)
|
||||
{
|
||||
print ("<h5>L'erreur est normale si vous avez essayé de recharger la page");
|
||||
}
|
||||
print("<h5>Adressez-vous aux responsables de l'association, ils ont déjà été averti de l'erreur</h5>" . EOLH);
|
||||
log_error( "vote non pris en compte : idVotant=$idVotant, id_Votation=$votation, key=$key, value=$value");
|
||||
voter($procurant, $votation, $vote);
|
||||
}
|
||||
//echo "$key => $value";
|
||||
}
|
||||
$db->close();
|
||||
print(' </div>
|
||||
|
Reference in New Issue
Block a user