- Timestamp:
- Jan 16, 2019, 7:06:35 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/footer.php
r230 r256 12 12 die(); 13 13 } 14 echo "</td></tr><tr><td >";14 echo "</td></tr><tr><td colspan=\"2\">"; 15 15 include("versione.php"); 16 16 -
trunk/admin/modules/Elezioni/backup.php
r2 r256 5 5 if (isset($param['id_comune'])) 6 6 $id_comune2=intval($param['id_comune']); 7 $result = mysql_query("select descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'", $dbi); 8 list($nomeFile) = mysql_fetch_row($result); 7 $sql="select descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'"; 8 $sth = $dbi->prepare("$sql"); 9 $sth->execute(); 10 $row = $sth->fetch(PDO::FETCH_BOTH); 11 $nomeFile=$row[0]; 9 12 #$nomeFile="backup"; 10 13 header( 'Content-Type: application/octet-stream' ); -
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"; -
trunk/admin/modules/Elezioni/controllo_voti.php
r254 r256 26 26 $perms=ChiSei($id_cons_gen); 27 27 if ($perms<16 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 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); 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 28 $sql="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'"; 29 $sth = $dbi->prepare("$sql"); 30 $sth->execute(); 31 $row = $sth->fetch(PDO::FETCH_BOTH); 32 list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = explode($row); 33 $sql="SELECT genere,voto_g,voto_l FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons'"; 34 $sth = $dbi->prepare("$sql"); 35 $sth->execute(); 36 $row = $sth->fetch(PDO::FETCH_BOTH); 37 list($genere,$votog,$votol) = explode($row); 33 38 include("modules/Elezioni/funzionidata.php"); 34 39 include("modules/Elezioni/ele.php"); … … 44 49 45 50 global $prefix, $dbi,$fascia,$limite; 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); 51 $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'"; 52 $sth = $dbi->prepare("$sql"); 53 $sth->execute(); 54 $row = $sth->fetch(PDO::FETCH_BOTH); 55 list($totm,$totf) = explode($row); 48 56 $totel=$totm+$totf; 49 57 if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina 50 58 if (!IsSet($num_ref)) { 51 59 $num_ref=1; 52 $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi); 53 $num_refs= mysql_num_rows($resg); //quante pagine? 60 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons"; 61 $sth = $dbi->prepare("$sql"); 62 $sth->execute(); 63 $row = $sth->fetch(PDO::FETCH_BOTH); 64 $num_refs= $sth->rowCount(); //quante pagine? 54 65 } 55 66 if((($genere!=4) and $pag==0 and !$votog) or $genere==1 or $genere==2){ //diverso da liste a piu' candidati … … 59 70 } 60 71 OpenTable(); 61 $resg = mysql_query("SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref", $dbi); 62 list($idg,$numg) = mysql_fetch_row($resg); 63 $res = mysql_query("SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ 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); 64 $num_sez = mysql_num_rows($res); //quante sezioni? 72 $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref"; 73 $sth = $dbi->prepare("$sql"); 74 $sth->execute(); 75 $row = $sth->fetch(PDO::FETCH_BOTH); 76 list($idg,$numg) = explode($row); 77 $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ 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"; 78 $sth = $dbi->prepare("$sql"); 79 $sth->execute(); 80 $num_sez = $sth->rowCount(); //quante sezioni? 65 81 for ($i=1;$i<=$num_sez;$i++){ 66 $sezione[$i]= mysql_fetch_array($res, 3); //inizializza l'array delle sezioni82 $sezione[$i]== $sth->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni 67 83 $ar[$i]=0; 68 84 } … … 88 104 $riga1= "<tr><td>\n<table border=\"0\" width=\"100%\" bgcolor=\"$bgcolor1\" ><tr><td align=\"center\">"._SEZSCR." "._CONSULTAZIONE." N. ".$numg."</td></tr></table></td></tr>\n"; 89 105 } 90 $res = mysql_query("$tab ", $dbi); 91 $num_scr = mysql_num_rows($res); 106 $sth = $dbi->prepare("$tab "); 107 $sth->execute(); 108 $num_scr = $sth->rowCount(); 92 109 $riga2= "<tr><td>\n<table border=\"0\" width=\"100%\" bgcolor=\"$bgcolor1\" ><tr><td align=\"center\">"._SEZIONI." $num_scr "._SU." $num_sez</td></tr></table></td></tr>\n";//sezioni scrutinate 93 110 $riga2 .= "<tr><td>\n<table border=\"0\" width=\"100%\" align=\"center\">"; … … 106 123 // $riga3 .= "<td><b>"._PREFLIS."</b></td>"; 107 124 $riga3 .= "<td><b>"._STATO."</b></td></tr>\n"; 108 $res = mysql_query("$tab ", $dbi);//die($tab);109 $num_scr = mysql_num_rows($res);110 125 $righe= ""; 111 126 $scrutinate=1; 112 127 // if ($genere>1 and $pag==1) $ops=3; 113 128 $tot_u=0;$tot_d=0;$tot_voti=0; $tot_si=0;$tot_no=0;$tot_validi=0;$tot_nulli=0;$tot_bianchi=0;$tot_contestati=0;$tgrup_pref=0;$tot_voti_nulli=0;$tot_val_lista=0;$tot_vot_nul_lis=0;$tot_cont_lis=0;$tot_solog=0;$tot_solol=0;$errors=0; 114 while (list($id_gruppo,$id,$num,$si,$no,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$voti_nulli,$val_lista,$vot_nul_lis,$cont_lis,$solog,$solol) = mysql_fetch_row($res)){ 129 while ( $row = $sth->fetch(PDO::FETCH_BOTH)){ 130 //controllare 131 list($id_gruppo,$id,$num,$si,$no,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$voti_nulli,$val_lista,$vot_nul_lis,$cont_lis,$solog,$solol) = explode($row); 115 132 // inserimento numeri di sez non scrutinate 116 133 while ($scrutinate < $num) { … … 121 138 // fine inserimento 122 139 if (($genere==2 or $genere==3 or $genere==5) and !$votog and !$dettnulli) { 123 $respref = mysql_query("select sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id'", $dbi); 124 list ($gruppref) = mysql_fetch_row($respref); 140 $sql="select sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id'"; 141 $sth2 = $dbi->prepare("$sql"); 142 $sth2->execute(); 143 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 144 list ($gruppref) = explode($row2); 125 145 $tgrup_pref += $gruppref; 126 146 } 127 147 $tab2="SELECT max(voti_donne),max(voti_uomini),max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id'"; 128 148 if ($genere==0) $tab2 .= " and id_gruppo=$id_gruppo"; 129 $res2 = mysql_query($tab2, $dbi); 130 list($votid,$votiu,$voti) = mysql_fetch_row($res2); 149 $sth2 = $dbi->prepare("$tab2"); 150 $sth2->execute(); 151 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 152 list($votid,$votiu,$voti) = explode($row2); 131 153 // $voti=$votiu+$votid; 132 154 … … 161 183 if($genere==5 and !$votog) #$validi+$nulli+$bianchi+$vcont+$vn 162 184 if($pag==0 and !$votog or $fascia<=$limite) {$controllo1=$validi+$nulli+$bianchi+$contestati+$voti_nulli;} else { $controllo1=$val_lista+$nulli+$bianchi+$contestati+$voti_nulli+$cont_lis+$vot_nul_lis+$solog;$controllo2=$si+$no-$solol+$cont_lis+$vot_nul_lis;} 163 $cerr=mysql_query("select stato_lis from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id'", $dbi); 164 list($crlis)=mysql_fetch_row($cerr); 185 $sth2 = $dbi->prepare("select stato_lis from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id'"); 186 $sth2->execute(); 187 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 188 list($crlis) = explode($row2); 189 165 190 if ($voti==$controllo1 and $validi==$controllo2 and !$g_err and $crlis!=-1){ 166 191 $righe .= "<td>"._OK."</td></tr>\n"; -
trunk/admin/modules/Elezioni/ele.php
r255 r256 64 64 $bgcolor1='#e7e7e7'; 65 65 $row=descr_comune();$descr_comu=$row['descrizione']; 66 # $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'"; 67 # $res = mysql_query($sqlcomu); 68 # list($descr_comu)=mysql_fetch_row($res); 69 $sqlcomu="select fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"; 70 $res = mysql_query($sqlcomu); 71 if ($res) 72 list($fascia)=mysql_fetch_row($res); 66 67 $row=daticonscom(); 68 if ($row['fascia']) $fascia=$row['fascia']; 73 69 else 74 70 $fascia=0; … … 109 105 // controllo delle opzioni utilizzabili: sono quelle che hanno genitori in quella precedente 110 106 // esempio si possono inserire i candidati solo se prima sono state inserite le liste 111 $resq = mysql_query("select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons", $dbi); 112 if ($resq) list($nrcirco)=mysql_fetch_row($resq); else $nrcirco=0; 113 $resq = mysql_query("select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi); 114 if ($resq) list($nrsede)=mysql_fetch_row($resq); else $nrsede=0; 115 $resq = mysql_query("select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi); 116 if ($resq) list($nrgruppo)=mysql_fetch_row($resq); else $nrgruppo=0; 117 $resq = mysql_query("select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons", $dbi); 118 if ($resq) list($nrlista)=mysql_fetch_row($resq); else $nrlista=0; 119 $resq = mysql_query("SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons", $dbi); 120 if ($resq) list($nraff)=mysql_fetch_row($resq); else $nraff=0; 107 $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons"; 108 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrcirco=$row[0];} 109 catch(PDOException $e) {$nrcirco=0; } 110 $sql="select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons"; 111 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrsede=$row[0];} 112 catch(PDOException $e) {$nrsede=0; } 113 $sql="select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons"; 114 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrgruppo=$row[0];} 115 catch(PDOException $e) {$nrgruppo=0; } 116 $sql = "select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons"; 117 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrlista=$row[0];} 118 catch(PDOException $e) {$nrlista=0; } 119 $sql = "SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons"; 120 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $nraff=$row[0];} 121 catch(PDOException $e) {$nraff=0; } 121 122 if ($genere==0) $tmpval='voti_ref'; else $tmpval='sezioni'; 122 $resq = mysql_query("SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons", $dbi); 123 if ($resq) list($nrvoti)=mysql_fetch_row($resq); else $nrvoti=0; 124 unset($resq); 123 $sql = "SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons"; 124 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrvoti=$row[0];} 125 catch(PDOException $e) {$nrvoti=0; } 126 unset($row); 125 127 if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare 126 128 { … … 178 180 179 181 <a href=\"admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br> 180 <a href=\"admin.php?op=associazioni&id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br />182 <a href=\"admin.php?op=associazioni&id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br> 181 183 <a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a> 182 184 </td></tr>"; -
trunk/admin/modules/Elezioni/ele_affluenze.php
r255 r256 135 135 $sth = $dbi->prepare("$sql"); 136 136 $sth->execute(); 137 $row = $sth->fetchAll();137 # $row = $sth->fetchAll(); 138 138 $tipo= $sth->rowCount(); 139 139 if(($tipo==0) and ($dadata <= $cdata) and ($adata >= $cdata)){ -
trunk/admin/modules/Elezioni/ele_associazioni.php
r254 r256 71 71 echo "} \n"; 72 72 echo "else document.getElementById('trspunta').style.visibility='visible' \n"; 73 # echo "if (document.getElementById('chiusa').options[3].selected==false) { \n";74 73 echo "if (document.getElementById('chiusa').selectedIndex!=3) { \n"; 75 74 echo "document.getElementById('add').value=\""._MODIFY."\" \n"; … … 124 123 echo "<table width=\"100%\" border=\"3\">"; 125 124 echo "<tr align=\"center\"><td bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>"; 126 # echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";127 125 echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 128 126 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>"; … … 135 133 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._ASOLO_GRUPPO."</b></td>"; 136 134 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DISGIUNTO."</b></td>"; 137 # echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&id_cons_gen=\">";138 135 echo "</tr>"; 139 136 echo "<tr align=\"center\"><td>"; 140 137 echo "<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 141 138 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">$descr_cons</td>"; 142 # $ressede = mysql_query("SELECT id_collegio, descrizione from ".$prefix."_ele_collegi where id_cons_gen='$id_cons_gen' order by descrizione desc", $dbi);143 # if ($num_coll=mysql_num_rows($ressede)){144 # echo "<td><select name=\"id_collegio\">";145 # while(list($id,$descr_coll)=mysql_fetch_row($ressede)){146 # $sel= ($id == $id_collegio) ? "selected":"";147 # echo "<option value=\"$id\" $sel>$descr_coll";148 # }149 # echo "</select></td>";150 # } else echo "<td></td>";151 139 $rescomu = mysql_query("SELECT id_comune, descrizione from ".$prefix."_ele_comuni order by descrizione asc", $dbi); 152 140 echo "<td>"; … … 241 229 echo "<input type=\"submit\" id=\"add\" name=\"add\" value=\""._MODIFY."\" ></td></tr>"; 242 230 echo "<tr><td colspan=\"5\"><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov1\">"._SPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_cons()\"></label></fieldset></td></tr>"; 243 # <div id=\"trspunta\" style=\"visibility:hidden\"> </div>244 231 echo "<tr id=\"trspunta\" style=\"visibility:hidden\"><td colspan=\"4\"><fieldset><legend>"._SPUNTALABEL2."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd4\" name=\"pwd4\" value=\"1\" onclick=\"javascript:del_cons()\"></label></fieldset>"; 245 232 }else{ … … 249 236 $i=0; 250 237 echo "</td></tr></table></form>"; 251 ############252 238 echo "<hr><br><table width=\"100%\" border=\"3\">"; 253 239 echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."TEST:$id_cons_comu</b></td>"; 254 # echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";255 240 echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 256 241 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>"; … … 263 248 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._ASOLO_GRUPPO."</b></td>"; 264 249 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DISGIUNTO."</b></td>"; 265 # echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SG."</b></td>"; 266 echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b> "._FUNZIONI."</td></tr>"; 267 ############### 268 269 # if ($num_coll>0) 270 # $resmod = mysql_query("SELECT t1.id_collegio,t1.id_comune,t2.descrizione as descr,t1.id_cons, t3.descrizione, t4.chiusa,t4.id_conf FROM ".$prefix."_ele_comu_collegi as t1, ".$prefix."_ele_collegi as t2, ".$prefix."_ele_comuni as t3, ".$prefix."_ele_cons_comune as t4 where t1.id_cons_gen='$id_cons_gen' and t1.id_collegio=t2.id_collegio and t1.id_comune=t3.id_comune and t1.id_comune=t4.id_comune and t2.id_cons_gen=t4.id_cons_gen order by t2.descrizione, t3.descrizione", $dbi); 271 # else 250 echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b> "._FUNZIONI."</b></td></tr>"; 251 272 252 $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze,t1.id_fascia,t1.vismf,t1.solo_gruppo,t1.disgiunto FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione", $dbi); 273 253 while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2,$fasciacom,$vismf2,$sg2,$disgiunto2) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti … … 276 256 $i++; 277 257 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 278 if($tipo_cons==3) echo "<tr><td colspan=\"8\">"; else echo "<tr><td colspan=\"8\">"; 258 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">"; 259 echo "<td><b>$descr_cons</b></td>"; 260 echo "<td><b>$descr_comu</b></td>"; 261 echo "<td><b>$preferenze2</b></td>"; 262 $stato['0']=_ATTIVA; 263 $stato['1']=_CHIUSA; 264 $stato['2']=_NULLA; 265 echo "<td><b>".$stato[$chiusa]."</b></td>"; 266 if($tipo_cons==3){ 267 echo "<td><b>".$descr_conf."</b></td>"; 268 $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi); 269 $inffascia=0; 270 if (mysql_num_rows($rescomu)==0) echo "<td></td>"; 271 while(list($id,$abitanti)=mysql_fetch_row($rescomu)){ 272 $sel=''; 273 if ($id == $fasciacom) 274 echo "<td>$inffascia - $abitanti</td>"; 275 $inffascia=$abitanti; 276 } 277 278 } 279 if ($vismf2==0) $sel=_NO; else $sel=_SI; 280 echo "<td>$sel</td>"; 281 if ($sg2==0) $sel=_NO; else $sel=_SI; 282 echo "<td>$sel</td>"; 283 if ($disgiunto2==0) $sel=_NO; else $sel=_SI; 284 echo "<td>$sel</td>"; 285 echo "<td>"; 279 286 echo "<form name=\"modello$i\" action=\"admin.php\">" 280 ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 281 // echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; 282 # echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio\">"; 287 ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 288 echo "<input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\">"; 283 289 echo "<input type=\"hidden\" name=\"idcomune\" value=\"$id_comune2\">"; 284 290 echo "<input type=\"hidden\" name=\"id_cons_comu\" value=\"$id_cons_comu\">"; … … 287 293 echo "<input type=\"hidden\" name=\"preferenze\" value=\"$preferenze2\">"; 288 294 echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">"; 289 echo "<table width=\"100%\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"; 290 echo "<td width=\"15%\"><b>$descr_cons</b></td>"; 291 echo "<td width=\"20%\"><b>$descr_comu</b></td>"; 292 echo "<td width=\"10%\"><b>$preferenze2</b></td>"; 293 $stato['0']=_ATTIVA; 294 $stato['1']=_CHIUSA; 295 $stato['2']=_NULLA; 296 echo "<td width=\"10%\"><b>".$stato[$chiusa]."</b></td>"; 297 if($tipo_cons==3){ 298 echo "<td width=\"20%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>"; 299 $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi); 300 $inffascia=0; 301 while(list($id,$abitanti)=mysql_fetch_row($rescomu)){ 302 $sel=''; 303 if ($id == $fasciacom) 304 echo "<td width=\"20%\">$inffascia - $abitanti</td>"; 305 $inffascia=$abitanti; 306 } 307 308 } 309 if ($vismf2==0) $sel=_NO; else $sel=_SI; 310 echo "<td width=\"10%\">$sel</td>"; 311 if ($sg2==0) $sel=_NO; else $sel=_SI; 312 echo "<td width=\"10%\">$sel</td>"; 313 if ($disgiunto2==0) $sel=_NO; else $sel=_SI; 314 echo "<td width=\"10%\">$sel</td>"; 315 # if ($sg==0) $sel=_NO; else $sel=_SI; 316 # echo "<td width=\"10%\">$sel</td>"; 317 echo "<td width=\"10\"><input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">" 318 ."</td></tr></table></form></td></tr>\n"; 319 } 320 echo "</table></td></tr>"; 321 echo "</table></td></tr>"; 295 echo "<input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">" 296 ."</form></td></tr>\n"; 297 } 298 echo "</table></td></tr></table>"; 322 299 CloseTable(); 323 # echo "</div>";324 300 } 325 301 … … 386 362 387 363 388 # die ("do:$do - id_cons:$id_cons_comu - idcomune:$id_comune - new: $idcomunenew");389 364 390 365 //**************************** -
trunk/admin/modules/Elezioni/ele_configurazione.php
r255 r256 15 15 // Offset - visualizza il numero di elementi per pagina 16 16 $offset=5; 17 17 global $dbi; 18 18 $aid=$_SESSION['aid']; 19 $dbi=$_SESSION['dbi'];20 19 $prefix=$_SESSION['prefix']; 21 20 $currentlang=$_SESSION['lang']; … … 26 25 27 26 $id_comune=$_SESSION['id_comune']; 27 28 include("modules/Elezioni/funzionidata.php"); 29 include("modules/Elezioni/ele.php"); 28 30 $row=cur_cons(); 29 31 $tipo_cons=$row[0];$id_cons=$row[1]; 30 31 include("modules/Elezioni/funzionidata.php");32 include("modules/Elezioni/ele.php");33 32 34 33 if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; … … 73 72 echo "<form name=\"gruppo2\" enctype=\"multipart/form-data\" method=\"post\" action=\"admin.php\">" 74 73 ."<input type=\"hidden\" name=\"op\" value=\"confconsiglio\">"; 75 $resl = mysql_query("SELECT * FROM ".$prefix."_config", $dbi); 76 $gru=mysql_fetch_array($resl); 74 $sql="SELECT * FROM ".$prefix."_config"; 75 $sth = $dbi->prepare("$sql"); 76 $sth->execute(); 77 $gru = $sth->fetch(PDO::FETCH_BOTH); 77 78 echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; 78 79 echo "<input type=\"hidden\" name=\"op\" value=\"configurazione\">"; … … 89 90 90 91 91 $resmod = mysql_query("SELECT tema FROM ".$prefix."_ele_temi order by tema", $dbi); 92 92 $sql="SELECT tema FROM ".$prefix."_ele_temi order by tema"; 93 $sth = $dbi->prepare("$sql"); 94 $sth->execute(); 95 $row = $sth->fetchAll(); 93 96 echo "<td><select name=\"tema2\">\n"; 94 95 while (list($desc) = mysql_fetch_row($resmod)){ 97 foreach($row as $com) {$desc=$com[0]; 96 98 if (!$gru['tema']) $gru['tema']=$desc; 97 99 $sel= ($gru['tema']==$desc) ? "selected":""; … … 117 119 echo"<td><b>"._SITENAME."</b></td><td><input type=\"text\" name=\"sitename\" value=\"".$gru['sitename']."\"></td></tr>"; 118 120 119 $resmod = mysql_query("SELECT id_comune,descrizione FROM ".$prefix."_ele_comuni order by descrizione", $dbi); 121 $sql = "SELECT id_comune,descrizione FROM ".$prefix."_ele_comuni order by descrizione"; 122 $sth = $dbi->prepare("$sql"); 123 $sth->execute(); 124 $row = $sth->fetchAll(); 120 125 echo "<tr><td><b>"._SITEISTAT."</b></td>"; 121 126 echo "<td><select name=\"siteistat\"><option value=\"\">"; 122 while (list($id_comune2,$desc) = mysql_fetch_row($resmod)){ 127 foreach($row as $com) 128 {$id_comune2=$com[0];$desc=$com[1]; 123 129 if (!$gru['siteistat']) $gru['siteistat']=$id_comune2; 124 130 $sel= ($gru['siteistat']==$id_comune2) ? "selected":""; … … 187 193 #displayerrors='$displayerrors', 188 194 #per il momento non Ú usato: , site_logo='$site_logo' 189 $result = mysql_query("update ".$prefix."_config set sitename='$sitename', testata='$stemmablob', nome_testata='$stemmanome', blocco='$blocco', multicomune='$multicomune', language='$language2', siteistat='$siteistat', adminmail='$adminmail', siteurl='$siteurl', flash='$flash2', tema='$tema2',gkey='$gkey',ed_user='$ed_user',googlemaps='$googlemaps',editor='$editor',tema_on='$tema_on'", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error()); 195 $sql = "update ".$prefix."_config set sitename='$sitename', testata='$stemmablob', nome_testata='$stemmanome', blocco='$blocco', multicomune='$multicomune', language='$language2', siteistat='$siteistat', adminmail='$adminmail', siteurl='$siteurl', flash='$flash2', tema='$tema2',gkey='$gkey',ed_user='$ed_user',googlemaps='$googlemaps',editor='$editor',tema_on='$tema_on'"; 196 $sth = $dbi->prepare("$sql"); 197 $sth->execute(); 190 198 if ($tema2=='facebook') 191 199 $_SESSION['tema']=$tema2; … … 223 231 if ( (preg_match('/^([_0-9a-zA-Z]+)([_0-9a-zA-Z]{3})$/',$tlist[$i])) ) $files=$tlist[$i]; 224 232 if($files!=''){ 225 $sql = mysql_query("SELECT id FROM ".$prefix."_ele_temi where tema='$files'", $dbi); 226 if($sql){ 227 list($idwid) = mysql_fetch_row($sql); 228 $id = intval($idwid); 229 } 233 $sql = "SELECT id FROM ".$prefix."_ele_temi where tema='$files'"; 234 $sth = $dbi->prepare("$sql"); 235 $sth->execute(); 236 $row = $sth->fetch(PDO::FETCH_BOTH); 237 $id = intval($row[0]); 238 230 239 if (empty($id)) { // inserisce widget db se non esiste 231 $result = mysql_query("insert into ".$prefix."_ele_temi (id,tema) values ( NULL,'$files')", $dbi); 240 $sql="insert into ".$prefix."_ele_temi (id,tema) values ( NULL,'$files')"; 241 $sth = $dbi->prepare("$sql"); 242 $sth->execute(); 232 243 } 233 }244 } 234 245 235 246 … … 243 254 244 255 # se non esiste cancella dal db 245 $sql2 = mysql_query("SELECT * FROM ".$prefix."_ele_temi", $dbi); 246 while ($row = mysql_fetch_array($sql2)) { 256 $sql = "SELECT * FROM ".$prefix."_ele_temi"; 257 $sth = $dbi->prepare("$sql"); 258 $sth->execute(); 259 $sql2 = $sth->fetch(PDO::FETCH_BOTH); 260 foreach($sql2 as $row){ 247 261 $esi=0; 248 262 for ($i=0; $i < sizeof($tlist); $i++) { … … 251 265 } 252 266 if($esi!=1){ 253 $del=mysql_query("DELETE FROM ".$prefix."_ele_tema WHERE id = '$row[id]'",$dbi); 267 $sql="DELETE FROM ".$prefix."_ele_temi WHERE id = '$row[id]'"; 268 $sth = $dbi->prepare("$sql"); 269 $sth->execute(); 254 270 } 255 271 } -
trunk/admin/modules/Elezioni/ele_cons_comuni.php
r122 r256 13 13 } 14 14 15 global $dbi; 15 16 $aid=$_SESSION['aid']; 16 $dbi=$_SESSION['dbi'];17 17 $prefix=$_SESSION['prefix']; 18 18 if($param) … … 23 23 $perms=ChiSei(0); 24 24 if ($perms<64 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 25 $res = mysql_query("SELECT tipo_cons,descrizione FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen' " , $dbi);26 list($tipo_cons,$descr_cons) = mysql_fetch_row($res);27 25 include("modules/Elezioni/funzionidata.php"); 28 26 include("modules/Elezioni/ele.php"); 27 $row=descr_cons(); 28 $tipo_cons=$row[0];$descr_cons=$row[2]; 29 29 30 if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; 30 31 if (isset($param['ok'])) get_magic_quotes_gpc() ? $ok=$param['ok']:$ok=addslashes($param['ok']); else $ok=''; … … 48 49 49 50 if (isset($help)) include("language/$language/ele_cons_comuni.html"); 50 51 $row=descr_comune(); 51 52 $res = mysql_query("SELECT id_cons FROM ".$prefix."_ele_comuni where id_comune=$id_comune", $dbi); 52 if (isset($res)) list($idpred) = mysql_fetch_row($res); else $idpred=''; 53 $res = mysql_query("SELECT t1.id_cons, t2.descrizione FROM ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_consultazione as t2 on t1.id_cons_gen=t2.id_cons_gen where t1.id_comune='$id_comune' " , $dbi); 54 $max = mysql_num_rows($res); 53 if (count($row)) $idpred = $row[2]; else $idpred=''; 54 # $res = mysql_query("SELECT t1.id_cons, t2.descrizione FROM ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_consultazione as t2 on t1.id_cons_gen=t2.id_cons_gen where t1.id_comune='$id_comune' " , $dbi); 55 $row=elenco_cons_comune(); 56 57 $max = count($row); 55 58 echo "<table border=\"0\" width=\"100%\" align=\"left\"><tr><td>"; 56 59 echo "<form name=\"imppred\" action=\"admin.php\">"; … … 58 61 ." <b>"._CONSPRED."</b> </td><td><select name=\"predefinita\">"; 59 62 echo "<option value=\"\">"; 60 while($arr=mysql_fetch_array($res,3)){63 foreach($row as $arr){ 61 64 $sel=''; 62 65 if (($idpred)) … … 77 80 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._COPIA." "._NUM." "._ELETTORI."</b></td>" 78 81 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FUNZIONI."</b></td></tr>"; 79 $result = mysql_query("select t2.chiusa,t2.id_cons,t1.* from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t2.id_comune='$id_comune' and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons!=$id_cons ORDER BY data_fine desc LIMIT $min,$offset", $dbi); 82 $sql = "select t2.chiusa,t2.id_cons,t1.* from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t2.id_comune='$id_comune' and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons!=$id_cons ORDER BY data_fine desc LIMIT $min,$offset"; 83 $sth = $dbi->prepare("$sql"); 84 $sth->execute(); 85 $row = $sth->fetchAll(); 80 86 $i=0; 81 while(list($chiusa,$id_cons2,$idconsgen2, $descr_cons, $data_inizio, $data_fine,$tipo) = mysql_fetch_row($result)) { 87 foreach($row as $arr) { 88 $chiusa=$arr[0];$id_cons2=$arr[1];$idconsgen2=$arr[2]; $descr_cons=$arr[3]; $data_inizio=$arr[4]; $data_fine=$arr[5];$tipo=$arr[6]; 82 89 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 83 $ressez = mysql_query("select count(id_cons) from ".$prefix."_ele_sezioni where id_cons='$id_cons2'", $dbi); 84 list($somma)=mysql_fetch_row($ressez); 90 $sql = "select count(id_cons) from ".$prefix."_ele_sezioni where id_cons='$id_cons2'"; 91 $sth = $dbi->prepare("$sql"); 92 $sth->execute(); 93 $row = $sth->fetch(PDO::FETCH_BOTH); 94 $somma=$row[0]; 85 95 $data_inizio=form_data($data_inizio);$data_fine=form_data($data_fine); 86 96 echo "<tr bgcolor=\"$bgcolor1\" align=\"center\" ><td align=\"left\" ><a href=\"admin.php?op=cons_comuni&id_cons_gen=$idconsgen2\"><b>$descr_cons</b></a></td>" … … 141 151 if ($perms>32) { 142 152 $sql="select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune=$id_comune"; 143 $res=mysql_query("$sql",$dbi); 144 list($id_consulta)=mysql_fetch_row($res); 153 $sth = $dbi->prepare("$sql"); 154 $sth->execute(); 155 $row = $sth->fetch(PDO::FETCH_BOTH); 156 $id_consulta=$row[0]; 145 157 $sql="select t1.descrizione from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t2.id_cons='$id_cons2' and t1.id_cons_gen=t2.id_cons_gen"; 146 $res=mysql_query("$sql",$dbi); 147 list($descr_cons2)=mysql_fetch_row($res); 158 $sth = $dbi->prepare("$sql"); 159 $sth->execute(); 160 $row = $sth->fetch(PDO::FETCH_BOTH); 161 162 $descr_cons2=$row[0]; 148 163 if ($do == "add") { 149 164 if ($id_cons2) { 150 165 // copia circoscrizione 151 $res=mysql_query("select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'", $dbi); 152 while (list($id,$idcirc,$num,$des2)=mysql_fetch_row($res)){ 153 $des=addslashes($des2); 154 $resconnew=mysql_query("select count(0) from ".$prefix."_ele_circoscrizione where id_cons='$id_cons2' and num_circ='$num'", $dbi); 155 list($contr_circ)=mysql_fetch_row($resconnew); 156 if (! $contr_circ){ 157 mysql_query("insert into ".$prefix."_ele_circoscrizione (id_cons,num_circ,descrizione) values ('$id_cons2',$num,'$des')", $dbi) || die("Impossibile inserire i dati delle circoscrizioni! ".mysql_error()); 158 } 159 $res0=mysql_query("select id_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons2 and num_circ=$num", $dbi); 160 list($id_circ)=mysql_fetch_row($res0); 166 $sql="select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'"; 167 $sth = $dbi->prepare("$sql"); 168 $sth->execute(); 169 $row = $sth->fetchAll(); 170 foreach($row as $arr){ 171 $id=$arr[0];$idcirc=$arr[1];$num=$arr[2];$des2=$arr[3]; 172 $des=addslashes($des2); 173 $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons='$id_cons2' and num_circ='$num'"; 174 $sth = $dbi->prepare("$sql"); 175 $sth->execute(); 176 $row = $sth->fetch(PDO::FETCH_BOTH); 177 $contr_circ=$row[0]; 178 if (! $contr_circ){ 179 sql="insert into ".$prefix."_ele_circoscrizione (id_cons,num_circ,descrizione) values ('$id_cons2',$num,'$des')"; 180 $sth = $dbi->prepare("$sql"); 181 $sth->execute(); 182 183 } 184 $sql="select id_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons2 and num_circ=$num"; 185 $sth = $dbi->prepare("$sql"); 186 $sth->execute(); 187 $row = $sth->fetch(PDO::FETCH_BOTH); 188 $id_circ=$row[0]; 161 189 // copia sede 162 $res1=mysql_query("select * from ".$prefix."_ele_sede where id_cons='$id_consulta' and id_circ='$idcirc'", $dbi); 163 while(list($id1,$idsede1,$idcirc1,$ind2,$tel,$tel2,$fax,$resp,$mappa2,$filemappa2)=mysql_fetch_row($res1)){ 190 $sql="select * from ".$prefix."_ele_sede where id_cons='$id_consulta' and id_circ='$idcirc'"; 191 $sth = $dbi->prepare("$sql"); 192 $sth->execute(); 193 $row = $sth->fetchAll(); 194 foreach($row as $row2) { 195 $id1=$row2[0];$idsede1=$row2[1];$idcirc1=$row2[2];$ind2=$row2[3];$tel=$row2[4];$tel2=$row2[5];$fax=$row2[6];$resp=$row2[7];$mappa2=$row2[8];$filemappa2=$row2[9]; 164 196 $filemappa=addslashes($filemappa2); 165 197 $mappa=addslashes($mappa2); 166 198 $ind=addslashes($ind2); 167 $ressednew=mysql_query("select count(0) from ".$prefix."_ele_sede where id_cons='$id_cons2' and indirizzo='$ind'", $dbi); 168 list($contr_sed)=mysql_fetch_row($ressednew); 169 if (! $contr_sed){ 170 mysql_query("insert into ".$prefix."_ele_sede (id_cons,id_circ,indirizzo,telefono1,telefono2,fax,responsabile,mappa,filemappa) values ('$id_cons2','$id_circ','$ind','$tel','$tel2','$fax','$resp','$mappa','$filemappa')", $dbi) || die("Impossibile inserire i dati delle sedi! ".mysql_error()); 171 } 172 $res2=mysql_query("select id_sede from ".$prefix."_ele_sede where id_cons=$id_cons2 and id_circ=$id_circ and indirizzo='$ind'", $dbi); 199 $sql="select count(0) from ".$prefix."_ele_sede where id_cons='$id_cons2' and indirizzo='$ind'"; 200 $sth = $dbi->prepare("$sql"); 201 $sth->execute(); 202 $row = $sth->fetch(PDO::FETCH_BOTH); 203 $contr_sed=$row[0]; 204 if (! $contr_sed){ 205 $sql="insert into ".$prefix."_ele_sede (id_cons,id_circ,indirizzo,telefono1,telefono2,fax,responsabile,mappa,filemappa) values ('$id_cons2','$id_circ','$ind','$tel','$tel2','$fax','$resp','$mappa','$filemappa')"; 206 $sth = $dbi->prepare("$sql"); 207 $sth->execute(); 208 } 209 $sql"select id_sede from ".$prefix."_ele_sede where id_cons=$id_cons2 and id_circ=$id_circ and indirizzo='$ind'"; 173 210 list($id_sede)=mysql_fetch_row($res2); 211 $sth = $dbi->prepare("$sql"); 212 $sth->execute(); 213 $row = $sth->fetch(PDO::FETCH_BOTH); 214 $id_sede=$row[0]; 174 215 //copia sezione 175 $res3=mysql_query("select * from ".$prefix."_ele_sezioni where id_cons=$id_consulta and id_sede=$idsede1", $dbi); 176 while (list($id3,$idsez3,$idsede3,$numero,$maschi3,$femmine3,$validi3,$nulli3, 177 $bianchi3,$contest3,$sg3,$aut_m,$aut_f)=mysql_fetch_row($res3)){ 216 $sql="select * from ".$prefix."_ele_sezioni where id_cons=$id_consulta and id_sede=$idsede1"; 217 $sth = $dbi->prepare("$sql"); 218 $sth->execute(); 219 $row = $sth->fetchAll(); 220 foreach($row as $arr2) 221 { 222 $id3=$arr2[0];$idsez3=$arr2[1];$idsede3=$arr2[2];$numero=$arr2[3];$maschi3=$arr2[4];$femmine3=$arr2[5];$validi3=$arr2[6];$nulli3=$arr2[7]; 223 $bianchi3=$arr2[8];$contest3=$arr2[9];$sg3,$aut_m=$arr2[10];$aut_f=$arr2[11]; 178 224 if ($elettori=='true') $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez,maschi,femmine) values ('$id_cons2','$id_sede','$numero','$maschi3','$femmine3')"; 179 225 else $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez) values ('$id_cons2','$id_sede','$numero')"; 180 mysql_query("$sql", $dbi) || die("Impossibile inserire i dati delle sezioni! ".mysql_error()); 226 $sth = $dbi->prepare("$sql"); 227 $sth->execute(); 228 181 229 } 182 230 } … … 191 239 echo "[ <a href=\"admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen\">"._NO."</a> ] - [<a href=\"admin.php?op=cons_comuni&do=elettori&id_cons_gen=$id_cons_gen&id_cons2=$id_cons2&ok=1\">"._YES."</a> ]";exit; 192 240 }else{ 193 $result = mysql_query("update ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sezioni as t2 set t1.maschi=t2.maschi, t1.femmine=t2.femmine WHERE t1.id_cons=$id_cons2 and t2.id_cons=$id_consulta and t1.num_sez=t2.num_sez", $dbi); 241 $sql="update ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sezioni as t2 set t1.maschi=t2.maschi, t1.femmine=t2.femmine WHERE t1.id_cons=$id_cons2 and t2.id_cons=$id_consulta and t1.num_sez=t2.num_sez"; 242 $sth = $dbi->prepare("$sql"); 243 $result=$sth->execute(); 244 194 245 if (!$result) return; 195 246 Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); … … 198 249 if ($do == "update") { 199 250 if ($predefinita) 200 $result = mysql_query("update ".$prefix."_ele_comuni set id_cons='$predefinita' WHERE id_comune='$id_comune'", $dbi); 201 else 202 $result = mysql_query("update ".$prefix."_ele_cons_comune set chiusa='$chiusa' WHERE id_cons2='$id_cons2'", $dbi); 203 if (!$result) return; 251 { 252 $sql="update ".$prefix."_ele_comuni set id_cons='$predefinita' WHERE id_comune='$id_comune'"; 253 $sth = $dbi->prepare("$sql"); 254 $result=$sth->execute(); 255 }else{ 256 $sql"update ".$prefix."_ele_cons_comune set chiusa='$chiusa' WHERE id_cons2='$id_cons2'"; 257 $sth = $dbi->prepare("$sql"); 258 $result=$sth->execute(); 259 } 260 if (!$result) return; 204 261 Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); 205 262 } -
trunk/admin/modules/Elezioni/ele_widget.php
r53 r256 15 15 // Offset - visualizza il numero di elementi per pagina 16 16 $offset=5; 17 17 global $dbi; 18 18 $aid=$_SESSION['aid']; 19 $dbi=$_SESSION['dbi'];20 19 $prefix=$_SESSION['prefix']; 21 20 $currentlang=$_SESSION['lang']; … … 26 25 27 26 $id_comune=$_SESSION['id_comune']; 28 $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); 29 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 27 #$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); 30 28 31 29 include("modules/Elezioni/funzionidata.php"); 32 30 include("modules/Elezioni/ele.php"); 31 $row=cur_cons(); 32 $tipo_cons=$row[0];$id_cons=$row[1]; 33 33 34 34 if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; … … 64 64 $files=$tlist[$i]; 65 65 66 $sql = mysql_query("SELECT id FROM ".$prefix."_ele_widget where nome_file='$files'", $dbi); 67 list($idwid) = mysql_fetch_row($sql); 66 $sql = "SELECT id FROM ".$prefix."_ele_widget where nome_file='$files'"; 67 $sth = $dbi->prepare("$sql"); 68 $sth->execute(); 69 $row = $sth->fetch(PDO::FETCH_BOTH); 70 $idwid=$row[0]; 68 71 $id = intval($idwid); 69 72 70 71 73 if (empty($id)) { // inserisce widget db se non esiste 72 $result = mysql_query("insert into ".$prefix."_ele_widget (id,nome_file,titolo,pos_or,pos_ver, attivo) values ( NULL,'$files', '$files','1','','0')", $dbi); 73 } 74 $sql="insert into ".$prefix."_ele_widget (id,nome_file,titolo,pos_or,pos_ver, attivo) values ( NULL,'$files', '$files','1','','0')"; 75 $sth = $dbi->prepare("$sql"); 76 $sth->execute(); } 74 77 75 78 … … 84 87 85 88 # se non esiste cancella dal db 86 $sql2 = mysql_query("SELECT * FROM ".$prefix."_ele_widget", $dbi); 87 while ($row = mysql_fetch_array($sql2)) { 89 $sql="SELECT * FROM ".$prefix."_ele_widget"; 90 $sth = $dbi->prepare("$sql"); 91 $sth->execute(); 92 $row2 = $sth->fetchAll(); 93 foreach($row2 as $row){ 88 94 $esi=0; 89 95 for ($i=0; $i < sizeof($tlist); $i++) { … … 92 98 } 93 99 if($esi!=1){ 94 $del=mysql_query("DELETE FROM ".$prefix."_ele_widget WHERE id = '$row[id]'",$dbi); 100 $sql="DELETE FROM ".$prefix."_ele_widget WHERE id = '$row[id]'"; 101 $sth = $dbi->prepare("$sql"); 102 $sth->execute(); 95 103 } 96 104 } … … 105 113 106 114 107 $result = mysql_query("SELECT * FROM ".$prefix."_ele_widget order by pos_or,pos_ver asc", $dbi); 108 115 $sql="SELECT * FROM ".$prefix."_ele_widget order by pos_or,pos_ver asc"; 116 $sth = $dbi->prepare("$sql"); 117 $sth->execute(); 118 $row2 = $sth->fetchAll(); 109 119 110 120 … … 113 123 echo "<br><table border=\"0\" width=\"100%\">"; 114 124 echo "<tr bgcolor=\"$bgcolor2\"><td align=\"center\"><b>"._CONFIGWIDGET."</b></td></tr></table>"; 115 116 while ($row = mysql_fetch_array($result)) { 125 foreach($row2 as $row) { 117 126 echo "<form name=\"widget\" enctype=\"multipart/form-data\" method=\"post\" action=\"admin.php\">"; 118 127 echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; … … 163 172 if ($perms >128) { 164 173 165 $result = mysql_query("update ".$prefix."_ele_widget set titolo='$titolo', pos_or='$pos_or', pos_ver='$pos_ver', attivo='$attivo' where id='$idw'", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error()); 174 $sql="update ".$prefix."_ele_widget set titolo='$titolo', pos_or='$pos_or', pos_ver='$pos_ver', attivo='$attivo' where id='$idw'"; 175 $sth = $dbi->prepare("$sql"); 176 $sth->execute(); 166 177 167 178 Header("Location: admin.php?id_cons_gen=$id_cons_gen&op=widget"); … … 185 196 function make_db_widget(){ 186 197 global $dbi,$prefix; 187 $ result = mysql_query("CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget (198 $sql="CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget ( 188 199 `id` int(10) NOT NULL auto_increment, 189 200 `nome_file` varchar(255) NOT NULL default '', … … 193 204 `attivo` int(1) NOT NULL default '0', 194 205 PRIMARY KEY (`id`) 195 )",$dbi); 206 )"; 207 $sth = $dbi->prepare("$sql"); 208 $sth->execute(); 196 209 197 210 -
trunk/admin/temi/default/index.php
r2 r256 10 10 $bgcolor="#b0b0b0"; 11 11 $nometema=$tema; 12 12 13 function testata($tema){ 13 14 global $nometema,$id_comune,$id_cons_gen,$aid,$dbi,$prefix; 14 15 $nometema=$tema; 15 $res_com = mysql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune'",$dbi); 16 $res_cons = mysql_query("SELECT descrizione FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'",$dbi); 17 list($descr_comune) = mysql_fetch_row($res_com); 18 list($descr_consultazione) = mysql_fetch_row($res_cons); 16 $sql="SELECT descrizione FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen' "; 17 $sth = $dbi->prepare("$sql"); 18 $sth->execute(); 19 $row = $sth->fetch(PDO::FETCH_BOTH); 20 $descr_consultazione=$row[0]; 21 $sql="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'"; 22 $sth = $dbi->prepare("$sql"); 23 $sth->execute(); 24 $row = $sth->fetch(PDO::FETCH_BOTH); 25 $descr_comune=$row[0]; 19 26 20 27 echo "<div class=\"container\"><table width=\"95%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table-main\"> -
trunk/client/temi/Futura2/index.php
r253 r256 207 207 ####################################### menu risultati 208 208 function risultati(){ 209 global $id_comune,$id_cons_gen,$genere,$tipo_cons,$colortheme ;209 global $id_comune,$id_cons_gen,$genere,$tipo_cons,$colortheme,$votoc; 210 210 echo '<div data-role="content" data-theme="'.$colortheme.'"> 211 211 <a href="modules.php?op=affluenze_all&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Affluenze</a> … … 215 215 if($genere==3 OR $genere==5) 216 216 echo '<a href="modules.php?op=liste_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._LISTA.'</a>'; 217 if(($genere==3 OR $genere==5) and $tipo_cons!="1" or $tipo_cons>="11")217 if(($genere==3 OR $genere==5) and !$votoc) 218 218 echo '<a href="modules.php?op=candidato_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._CANDIDATO.'</a>'; 219 219
Note:
See TracChangeset
for help on using the changeset viewer.