[139] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /************************************************************************/
|
---|
| 4 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 5 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 6 | /* http://www.eleonline.it */
|
---|
| 7 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 8 | /************************************************************************/
|
---|
| 9 | /* Modulo Controllo dei voti */
|
---|
| 10 | /* Amministrazione */
|
---|
| 11 | /************************************************************************/
|
---|
| 12 |
|
---|
| 13 | if (!defined('ADMIN_FILE')) {
|
---|
| 14 | die ("You can't access this file directly...");
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | $aid=$_SESSION['aid'];
|
---|
| 18 | $dbi=$_SESSION['dbi'];
|
---|
| 19 | $prefix=$_SESSION['prefix'];
|
---|
| 20 | $currentlang=$_SESSION['lang'];
|
---|
| 21 | $id_comune=$_SESSION['id_comune'];
|
---|
| 22 | $id_cons_gen=$_GET['id_cons_gen'];
|
---|
| 23 | $bgcolor1=$_SESSION['bgcolor1'];
|
---|
| 24 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 25 |
|
---|
| 26 | $perms=ChiSei($id_cons_gen);
|
---|
| 27 | if ($perms<16 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
[254] | 28 | $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons,t2.solo_gruppo,t2.disgiunto FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
|
---|
| 29 | list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = mysql_fetch_row($res);
|
---|
[139] | 30 | $res = mysql_query("SELECT genere,voto_g,voto_l FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' " , $dbi);
|
---|
| 31 | list($genere,$votog,$votol) = mysql_fetch_row($res);
|
---|
| 32 |
|
---|
| 33 | include("modules/Elezioni/funzionidata.php");
|
---|
| 34 | include("modules/Elezioni/ele.php");
|
---|
| 35 | if (! get_magic_quotes_gpc()) $magic='addslashes'; else $magic='';
|
---|
| 36 | if (isset($param['ops'])) get_magic_quotes_gpc() ? $ops=$param['ops']:$ops=addslashes($param['ops']); else $ops='';
|
---|
| 37 | if (isset($param['pag'])) $pag=intval($param['pag']); else $pag=0;
|
---|
| 38 | if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']);
|
---|
| 39 | if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']);
|
---|
| 40 | ele();
|
---|
| 41 | //**************************************************************************
|
---|
| 42 | // ELE
|
---|
| 43 | //**************************************************************************
|
---|
| 44 |
|
---|
[163] | 45 | global $prefix, $dbi,$fascia,$limite,$genere,$votog;
|
---|
[139] | 46 | $res = mysql_query("SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi);
|
---|
| 47 | list($totm,$totf) = mysql_fetch_row($res);
|
---|
| 48 | $totel=$totm+$totf;
|
---|
[208] | 49 | $res = mysql_query("SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc, orario desc limit 0,1", $dbi);
|
---|
[139] | 50 | list($giorno,$ora)=mysql_fetch_row($res);
|
---|
| 51 | $res = mysql_query("SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora'", $dbi);
|
---|
[170] | 52 | list($votf,$votm,$votc) = mysql_fetch_row($res);
|
---|
[250] | 53 | if($genere!=0){
|
---|
| 54 | $res = mysql_query("SELECT sum(solo_gruppo),sum(validi),sum(nulli),sum(bianchi),sum(contestati), sum(voti_nulli),sum(validi_lista),sum(voti_nulli_lista),sum(contestati_lista),sum(solo_lista) FROM ".$prefix."_ele_sezioni where id_cons=$id_cons", $dbi);
|
---|
[139] | 55 | list($sg,$validi,$nulli,$bianchi,$contestati,$votinulli,$validilista,$nullilista,$contestatilista,$sl)=mysql_fetch_row($res);
|
---|
| 56 | echo "<center>";
|
---|
| 57 | echo "<fieldset><legend>"._VOTANTI."</legend>";
|
---|
| 58 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._ISCRITTI."</TH><TH>"._UOMINI."</TH><TH>"._DONNE."</TH><TH>"._VOTIU."</TH><TH>"._VOTID."</TH><TH>"._VOTIE."</TH></TR>";
|
---|
| 59 | ECHO "<TR><TH>".number_format($totel,0,',','.')."</TH><TH>".number_format($totm,0,',','.')."</TH><TH>".number_format($totf,0,',','.')."</TH><TH>".number_format($votm,0,',','.')."</TH><TH>".number_format($votf,0,',','.')."</TH><TH>".number_format($votc,0,',','.')."</TH></TR></table><br/>";
|
---|
| 60 | ECHO "</fieldset><br/><br/><br/>";
|
---|
[235] | 61 |
|
---|
| 62 |
|
---|
[139] | 63 | $totnulli=$nulli+$bianchi+$contestati+$votinulli;
|
---|
[174] | 64 | if ($votog) echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
| 65 | else echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
[250] | 66 |
|
---|
[139] | 67 | echo "<table border=\"1\" width=\"100%\"><tr><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._VOTINULLI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 68 | ECHO "<TR><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($votinulli,0,',','.')."</TH><TH>".number_format($totnulli,0,',','.')."</TH></TR></table><br/>";
|
---|
[250] | 69 | ECHO "</fieldset><br/><br/><br/>";
|
---|
| 70 | }else{
|
---|
| 71 | $res = mysql_query("SELECT sum(si),sum(no),sum(validi),sum(nulli),sum(bianchi),sum(contestati),id_gruppo FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' group by id_gruppo", $dbi);
|
---|
| 72 | while (list($si,$no,$validi,$nulli,$bianchi,$contestati,$idg) = mysql_fetch_row($res)){
|
---|
| 73 | $resref = mysql_query("SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'", $dbi);
|
---|
| 74 | list($numgruppo,$descrizione) = mysql_fetch_row($resref);
|
---|
| 75 | echo "<fieldset><legend>"._GRUPPO."N. $numgruppo - $descrizione</legend>";
|
---|
| 76 | echo "<table border=\"1\" width=\"100%\"><tr><th><b> "._SI." </b></th><th><b>"._NO."</b></th><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 77 | ECHO "<TR><TH>".number_format($si,0,',','.')."</TH><TH>".number_format($no,0,',','.')."</TH><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($nulli+$bianchi+$contestati,0,',','.')."</TH></TR></table><br/>";
|
---|
| 78 | # votanti-------------- <th><b>"._GRUPPO."</b></th><th><b>"._DESCR."</b></th> --- <TH>".$numgruppo."</TH><TH>".$descrizione."</TH>
|
---|
| 79 | $resv = mysql_query("SELECT sum(voti_donne),sum(voti_uomini),sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$giorno' and orario='$ora' and id_gruppo='$idg'", $dbi);
|
---|
| 80 | list($votf,$votm,$votc) = mysql_fetch_row($resv);
|
---|
| 81 |
|
---|
| 82 | echo "<fieldset><legend>"._VOTANTI."</legend>";
|
---|
| 83 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._ISCRITTI."</TH><TH>"._UOMINI."</TH><TH>"._DONNE."</TH><TH>"._VOTIU."</TH><TH>"._VOTID."</TH><TH>"._VOTIE."</TH></TR>";
|
---|
| 84 | ECHO "<TR><TH>".number_format($totel,0,',','.')."</TH><TH>".number_format($totm,0,',','.')."</TH><TH>".number_format($totf,0,',','.')."</TH><TH>".number_format($votm,0,',','.')."</TH><TH>".number_format($votf,0,',','.')."</TH><TH>".number_format($votc,0,',','.')."</TH></TR></table>";
|
---|
| 85 | ECHO "</fieldset><br/>";
|
---|
| 86 | ECHO "</fieldset><br/><br/><br/>";
|
---|
| 87 |
|
---|
| 88 | #-----------
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
[235] | 91 |
|
---|
[174] | 92 | if ($genere==5 and !$votog) {
|
---|
[139] | 93 | $totnullil=$nullilista+$contestatilista;
|
---|
[208] | 94 | $id_conf=0;
|
---|
[235] | 95 | $res = mysql_query("SELECT t1.id_conf,t1.id_fascia, t2.limite, t1.solo_gruppo from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_conf as t2 on t1.id_conf=t2.id_conf where t1.id_cons='$id_cons'", $dbi);
|
---|
| 96 | if($res) list($id_conf,$fascia,$limite,$dettnulli) = mysql_fetch_row($res);
|
---|
[208] | 97 | if ($id_conf and $fascia<=$limite) {
|
---|
[139] | 98 | echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
[208] | 99 | echo "<table border=\"1\" width=\"100%\"><tr><th><b>"._VALIDI."</b></th><th>"._NULLI."</th><th>"._BIANCHI."</th><th>"._CONTESTATI."</th><th>"._VOTINULLI."</th><th>"._TOTNON."</th></TR>";
|
---|
| 100 | ECHO "<TR><TH>".number_format($validi,0,',','.')."</TH><TH>".number_format($nulli,0,',','.')."</TH><TH>".number_format($bianchi,0,',','.')."</TH><TH>".number_format($contestati,0,',','.')."</TH><TH>".number_format($votinulli,0,',','.')."</TH><TH>".number_format($totnulli,0,',','.')."</TH></TR></table><br/>";
|
---|
| 101 | ECHO "</fieldset><br/><br/><br/>";
|
---|
[235] | 102 |
|
---|
[208] | 103 | }else{
|
---|
[254] | 104 | if ($dettnulli or $disgiunto){
|
---|
[235] | 105 | $res = mysql_query("SELECT id_gruppo,num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_cons='$id_cons' order by num_gruppo", $dbi);
|
---|
| 106 |
|
---|
| 107 | echo "<fieldset><legend>"._GRUPPO."</legend>";
|
---|
[254] | 108 | echo "<table border=\"1\" width=\"100%\"><tr><th colspan=\"2\" rowspan=\"2\" ALIGN=\"CENTER\"><b>Candidato</b></th><th rowspan=\"2\" ALIGN=\"CENTER\">"._VALIDI."</th><th colspan=\"2\" ALIGN=\"CENTER\">"._SOLO_GRUPPO."</th></tr><tr><th ALIGN=\"CENTER\">Senza indicazione di lista</th>";
|
---|
| 109 | if ($disgiunto) echo "<th>"._SOLOLIS."</th>"; else echo "<th>"._VOTINULLI." di Lista</th>";
|
---|
| 110 | echo "</TR>";
|
---|
| 111 | $t_voti=0;$t_solo_gruppo=0;$t_nulli_lista=0;
|
---|
[235] | 112 | while(list($id_gruppo,$num_gruppo,$desc) = mysql_fetch_row($res)){
|
---|
| 113 | $resv = mysql_query("SELECT sum(voti),sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 114 | list($voti,$solo_gruppo)=mysql_fetch_row($resv);
|
---|
[254] | 115 | if($disgiunto){
|
---|
| 116 | $resv = mysql_query("SELECT sum(t1.solo_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'", $dbi);
|
---|
| 117 | }else{
|
---|
| 118 | $resv = mysql_query("SELECT sum(t1.nulli_lista) from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t2.id_gruppo='$id_gruppo'", $dbi);
|
---|
| 119 | }
|
---|
| 120 | list($perlista)=mysql_fetch_row($resv);
|
---|
| 121 | $t_voti+=$voti;$t_solo_gruppo+=$solo_gruppo;$t_perlista+=$perlista;
|
---|
| 122 | ECHO "<TR><TD>".$num_gruppo."</TD><TD>".$desc."</TD><TD ALIGN=\"RIGHT\">".number_format($voti,0,',','.')."</TD><TD ALIGN=\"RIGHT\">".number_format($solo_gruppo,0,',','.')."</TD><TD ALIGN=\"RIGHT\">".number_format($perlista,0,',','.')."</TD></TD></TR>";
|
---|
[235] | 123 | }
|
---|
[254] | 124 | echo "<tr><th colspan=\"2\" rowspan=\"2\" ALIGN=\"CENTER\"><b>Totale</b></th><th rowspan=\"2\" ALIGN=\"RIGHT\">$t_voti</th><th ALIGN=\"RIGHT\">$t_solo_gruppo</th><th ALIGN=\"RIGHT\">$t_perlista</th></tr>";
|
---|
[235] | 125 | ECHO "</table><br/></fieldset><br/><br/><br/>";
|
---|
| 126 |
|
---|
| 127 | }
|
---|
| 128 | echo "<fieldset><legend>"._VOTI_LISTA."</legend>";
|
---|
[163] | 129 | echo "<table border=\"1\" width=\"100%\"><tr><th>"._VALIDI."</th><th>"._VOTINULLI."</th><th>"._CONTESTATI."</th>";
|
---|
[174] | 130 | // if ($genere==5 and !$votog)
|
---|
[163] | 131 | echo "<th>"._SOLO_GRUPPO."</th>";
|
---|
| 132 | echo "<th>"._TOTNON."</th></TR>";
|
---|
[208] | 133 |
|
---|
| 134 | ECHO "<TR><TH>".number_format($validilista,0,',','.')."</TH><TH>".number_format($nullilista,0,',','.')."</TH><TH>".number_format($contestatilista,0,',','.')."</TH>";
|
---|
[163] | 135 | if($genere==5 and !$votog)
|
---|
| 136 | echo "<TH>".number_format($sg,0,',','.')."</TH>";
|
---|
| 137 | echo "<TH>".number_format($totnullil,0,',','.')."</TH></TR></table><br/>";
|
---|
[139] | 138 | ECHO "</fieldset>";
|
---|
[174] | 139 | }
|
---|
[208] | 140 | }
|
---|
[139] | 141 | echo "</center>";
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 |
|
---|
| 145 | echo "</table>\n</td></tr></table>\n";
|
---|
| 146 |
|
---|
| 147 | include ("footer.php");
|
---|
| 148 |
|
---|
| 149 | ?>
|
---|