Changeset 256 for trunk/admin/modules/Elezioni/controllo_votanti.php
- Timestamp:
- Jan 16, 2019, 7:06:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/controllo_votanti.php
r64 r256 24 24 $perms=ChiSei($id_cons_gen); 25 25 if ($perms<16 or !$id_cons_gen) die("$perms ".$_SESSION['id_comune'].$_SESSION['aid'].";Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 26 $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons 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); 27 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 28 $res = mysql_query("SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' " , $dbi); 29 list($genere) = mysql_fetch_row($res); 26 27 $sql="SELECT t1.descrizione,t1.tipo_cons,t2.id_cons 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'"; 28 $sth = $dbi->prepare("$sql"); 29 $sth->execute(); 30 $row = $sth->fetch(PDO::FETCH_BOTH); 31 $descr_consultazione=$row[0]; 32 $tipo_cons=$row[1]; 33 $id_cons=$row[2]; 34 $sql="SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' "; 35 $sth = $dbi->prepare("$sql"); 36 $sth->execute(); 37 $row = $sth->fetch(PDO::FETCH_BOTH); 38 $genere = $row[0]; 30 39 if (isset($param['ops'])) get_magic_quotes_gpc() ? $ops=$param['ops']:$ops=addslashes($param['ops']); else $ops=''; 31 40 if (isset($param['pag'])) $pag=intval($param['pag']); else $pag=0; … … 54 63 if (!IsSet($num_ref)) { 55 64 $num_ref=1; 56 $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi); 57 $num_refs= mysql_num_rows($resg); //quante pagine? 58 } 59 $resg = mysql_query("SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref", $dbi); 60 list($idg,$numg) = mysql_fetch_row($resg); 65 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons"; 66 $sth = $dbi->prepare("$sql"); 67 $sth->execute(); 68 $num_refs= $sth->rowCount(); //quante pagine? 69 } 70 $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref"; 71 $sth = $dbi->prepare("$sql"); 72 $sth->execute(); 73 $row = $sth->fetch(PDO::FETCH_BOTH); 74 $idg=$row[0]; 75 $numg=$row[1]; 61 76 $id_gruppo=$idg; 62 77 $cond= "and id_gruppo=$id_gruppo"; … … 64 79 } 65 80 $i=1; 66 $res = mysql_query("SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede order by num_sez", $dbi); 67 while ($linka[$i++] = mysql_fetch_array($res)); 68 $num_sez = mysql_num_rows($res); //numero totale delle sezioni 81 $sql"SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede order by num_sez"; 82 $sth = $dbi->prepare("$sql"); 83 $sth->execute(); 84 while ($linka[$i++] = $sth->fetch(PDO::FETCH_BOTH)); 85 $num_sez = $sth->rowCount(); //numero totale delle sezioni 69 86 $tot_compl=0;$tot_u=0;$tot_d=0; 70 87 // $ar['riga1'][0]="<hr>"; … … 85 102 $ar['perc'][1]=" "; 86 103 // $ar['riga2'][1]="<hr>"; 87 $resuo = mysql_query("SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1", $dbi); 88 list($ultora,$ultdata)=mysql_fetch_row($resuo); 89 90 $resril = mysql_query("SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario", $dbi); 91 $num_ril= mysql_num_rows($resril); //numero delle rilevazioni previste 104 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1"; 105 $sth = $dbi->prepare("$sql"); 106 $sth->execute(); 107 $row = $sth->fetch(PDO::FETCH_BOTH); 108 $ultora=$row[0]; 109 $ultdata=$row[1]; 110 111 $sql = "SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario"; 112 $resril = $dbi->prepare("$sql"); 113 $resril->execute(); 114 $num_ril = $resril->rowCount(); //numero delle rilevazioni previste 92 115 echo "\n<table border=\"0\" width=\"100%\" align=\"center\">"; 93 116 echo "<tr bgcolor=\"$bgcolor1\" align=\"center\"><td width=\"5%\"><b>"._SEZIONI."</b></td><td><b>"._ISCRITTI."<br>"._INSEZ."</b></td>"; 94 $ressomma = mysql_query("SELECT data,orario,sum(voti_complessivi),sum(voti_uomini),sum(voti_donne) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons $cond group by data,orario", $dbi); 95 while (list($data,$ora,$somma,$votiu,$votid) = mysql_fetch_row($ressomma)) { 117 $sql="SELECT data,orario,sum(voti_complessivi),sum(voti_uomini),sum(voti_donne) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons $cond group by data,orario"; 118 $sth = $dbi->prepare("$sql"); 119 $sth->execute(); 120 while ($row = $sth->fetch(PDO::FETCH_BOTH)) { 121 $data=$row[0]; 122 $ora=$row[1]; 123 $somma=$row[2]; 124 $votiu=$row[3]; 125 $votid=$row[4]; 96 126 $perc_u='';$perc_d='';$perc_c=''; 97 127 # if($votiu or $votid) … … 107 137 } 108 138 $ud=0;$ora_rif=""; 109 while ( list($data1,$ora1) = mysql_fetch_row($resril))139 while ($row2 = $resril->fetch(PDO::FETCH_BOTH)) 110 140 { 141 $data1=$row2[0]; 142 $ora1=$row2[1]; 111 143 $ud++; 112 144 list($hour, $minute, $second) = explode(":", $ora1); … … 115 147 if ($ud==$num_ril) {$ora_rif="$data1.$ora1";} 116 148 echo ">".form_data($data1)."<br>"._ORE." ".$ora_ril; 117 $resaff = mysql_query("SELECT count(data) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $cond", $dbi); 118 list($num_scr) = mysql_fetch_row($resaff); //numero delle sezioni inserite 149 $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $cond"; 150 $resaff = $dbi->prepare("$sql"); 151 $resaff->execute(); 152 $num_scr=$resaff->rowCount(); //numero delle sezioni inserite 119 153 echo "<br>"._SEZIONI." $num_scr "._SU." $num_sez"; 120 154 if ($ud==$num_ril) echo "<br>\n<table width=\"100%\"><tr align=\"center\"><td width=\"30%\">"._UOMINI."</td><td width=\"30%\">"._DONNE."</td><td>"._COMPLESSIVI."</td></tr></table>\n"; … … 142 176 } 143 177 } 144 $resvoti = mysql_query("SELECT data,orario,t2.num_sez,voti_uomini, voti_donne, voti_complessivi from ".$prefix."_ele_voti_parziale as t1, ".$prefix."_ele_sezioni as t2 where t1.id_cons=$id_cons and t1.id_sez=t2.id_sez $cond order by data,orario,t2.num_sez", $dbi); 178 $sql="SELECT data,orario,t2.num_sez,voti_uomini, voti_donne, voti_complessivi from ".$prefix."_ele_voti_parziale as t1, ".$prefix."_ele_sezioni as t2 where t1.id_cons=$id_cons and t1.id_sez=t2.id_sez $cond order by data,orario,t2.num_sez"; 179 $sth = $dbi->prepare("$sql"); 180 $sth->execute(); 145 181 $ud=0; 146 while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = mysql_fetch_row($resvoti)) { 182 while ($row = $sth->fetch(PDO::FETCH_BOTH)) { 183 $data=$row[0]; 184 $ora=$row[1]; 185 $numsez=$row[2]; 186 $uomini=$row[3]; 187 $donne=$row[4]; 188 $complessivi=$row[5]; 147 189 if ($ora_rif=="$data.$ora") 148 190 $ar[$numsez][$data.$ora]="\n<table width=\"100%\"><tr align=\"center\"><td width=\"30%\">$uomini</td><td width=\"30%\">$donne</td><td>$complessivi</td></tr></table>\n";
Note:
See TracChangeset
for help on using the changeset viewer.