\n"; echo "\n"; echo "

\n"; for($i=0; $i"; } echo "
".$vote_question.""; echo "\n"; echo $tab_opt[$i]."
\n"; echo "
\n"; echo "\n"; echo "
\n"; echo "\n"; } //pour obtenir le nombre function get_nbr($opt) { global $avoter_path; $fop = fopen($avoter_path."avoter/datafiles/".$opt.".data", "r"); $nbr = fgets($fop, 20); fclose($fop); return $nbr; } //calcul du pourcentage function get_percent($nbr, $nbr_total) { $percent = $nbr / $nbr_total * 100; $percent = round($percent); return $percent; } //affichage des résultats avec les barres function display_bar($opt, $nbr, $nbr_total) { global $bar_color, $bar_size; $percent = $nbr / $nbr_total * 100; $percent = round($percent); echo " \n
 
".$opt." (".$percent."%)\n"; } // fonction qui retourne le nombre total de vote function total_count() { global $tab_opt, $avoter_path; //on va chercher le nombre total de votes $nbr_total = "0"; for($i=0; $i"; else: if(!FILE_EXISTS($avoter_path."avoter/datafiles/".$opt.".data")): $fd = fopen($avoter_path."avoter/datafiles/".$opt.".data", 'w'); //création du fichier data si il n'existe pas endif; $fop = fopen($avoter_path."avoter/datafiles/".$opt.".data", "r"); $nbr = fgets($fop, 20); fclose($fop); $nbr++; $fop2 = fopen($avoter_path."avoter/datafiles/".$opt.".data", "w"); if($nbr == ""): $nbr = "1"; endif; fputs($fop2, $nbr); fclose($fop2); $fd = fopen($avoter_path."avoter/datafiles/ip/".$REMOTE_ADDR.".ip", 'w+'); //création du fichier ip echo "".$confirm_phrase."
"; endif; } //fonction qui affiche le nombre total (seulement si activé) function show_total() { global $nbr_total, $show_total; if($show_total=="1"): echo ""; echo "".$nbr_total." vote"; if($nbr_total > "1"): echo "s"; endif; echo "\n"; echo ""; endif; } //fonction d'affichage des résultats avec les conditions function show_all_result_if() { global $show_result, $tab_opt, $nbr_total, $vote_question, $table_width, $question_taille, $bg_question, $bg_vote; if($show_result == "1"): //on va chercher et afficher le résultat pour chaque option, si laffichage est activé echo "\n"; echo "\n"; for($i=0; $i"; } //fin de boucle 2 qui affiche les barres show_total(); echo "
".$vote_question.""; display_bar($tab_opt[$i], $nbr, $nbr_total); echo "
\n"; echo "
"; endif; } ?>