first commit
This commit is contained in:
		
							
								
								
									
										56
									
								
								vote.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								vote.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require "session_init.php";
 | 
			
		||||
require "config.inc.php";
 | 
			
		||||
require "db.class.php";
 | 
			
		||||
require_once 'entete.html';
 | 
			
		||||
 | 
			
		||||
$idVotant=$_GET["id"];
 | 
			
		||||
$votation=$_GET["v"];
 | 
			
		||||
$vote=$_GET["vote"];
 | 
			
		||||
 | 
			
		||||
$db = new db();
 | 
			
		||||
 | 
			
		||||
print('<br><br>
 | 
			
		||||
	<!-- lalis Grid Section -->
 | 
			
		||||
 | 
			
		||||
	<section id="content">
 | 
			
		||||
		<div class="container">
 | 
			
		||||
			<div class="row">
 | 
			
		||||
				<div class="col-lg-12 text-center">
 | 
			
		||||
					<h3>VOTE</h3>');
 | 
			
		||||
 | 
			
		||||
$query='SELECT * FROM liste_votes WHERE idVotation="' .$db->protect( $votation) .'"';
 | 
			
		||||
$result = $db->query($query);
 | 
			
		||||
$listeVotes = $db->result->fetch_all(MYSQLI_ASSOC);
 | 
			
		||||
 | 
			
		||||
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->close();
 | 
			
		||||
print('				</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</section>');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user