Changeset 258 for trunk/admin
- Timestamp:
- Apr 4, 2019, 11:16:00 PM (6 years ago)
- Location:
- trunk/admin
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r257 r258 144 144 echo $sql . "<br>" . $e->getMessage(); 145 145 } 146 147 146 148 147 … … 163 162 $_SESSION['startdate']=$row['startdate']; 164 163 $_SESSION['adminmail']=$row['adminmail']; 165 if ( $tema=='facebook')164 if (isset($tema) and $tema=='facebook') 166 165 $_SESSION['tema']=$row['tema']; 167 166 else $_SESSION['tema']='default'; … … 561 560 break; 562 561 } 562 563 563 }else { 564 564 -
trunk/admin/header.php
r239 r258 30 30 function head() { 31 31 global $csv,$tema; 32 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; 32 # echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; 33 echo "<!DOCTYPE HTML>\n"; 33 34 echo "<html>\n"; 34 35 echo "<head>\n"; -
trunk/admin/modules/Elezioni/controllo_votanti.php
r256 r258 16 16 17 17 $aid=$_SESSION['aid']; 18 $dbi=$_SESSION['dbi'];18 global $dbi; 19 19 $prefix=$_SESSION['prefix']; 20 20 $currentlang=$_SESSION['lang']; … … 79 79 } 80 80 $i=1; 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";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 82 $sth = $dbi->prepare("$sql"); 83 83 $sth->execute(); -
trunk/admin/modules/Elezioni/controllo_voti.php
r256 r258 16 16 17 17 $aid=$_SESSION['aid']; 18 $dbi=$_SESSION['dbi'];18 global $dbi; 19 19 $prefix=$_SESSION['prefix']; 20 20 $currentlang=$_SESSION['lang']; … … 29 29 $sth = $dbi->prepare("$sql"); 30 30 $sth->execute(); 31 $row = $sth->fetch(PDO::FETCH_BOTH); 32 list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = explode($row); 31 list($tipo_cons,$id_cons,$dettnulli,$disgiunto) = $sth->fetch(PDO::FETCH_BOTH); 33 32 $sql="SELECT genere,voto_g,voto_l FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons'"; 34 33 $sth = $dbi->prepare("$sql"); 35 34 $sth->execute(); 36 $row = $sth->fetch(PDO::FETCH_BOTH);37 list($genere,$votog,$votol) = explode($row);35 $row = 36 list($genere,$votog,$votol) = $sth->fetch(PDO::FETCH_NUM); 38 37 include("modules/Elezioni/funzionidata.php"); 39 38 include("modules/Elezioni/ele.php"); … … 52 51 $sth = $dbi->prepare("$sql"); 53 52 $sth->execute(); 54 $row = $sth->fetch(PDO::FETCH_BOTH);55 list($totm,$totf) = explode($row);53 # $row = $sth->fetch(PDO::FETCH_BOTH); 54 list($totm,$totf) = $sth->fetch(PDO::FETCH_NUM); 56 55 $totel=$totm+$totf; 57 56 if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina … … 61 60 $sth = $dbi->prepare("$sql"); 62 61 $sth->execute(); 63 $row = $sth->fetch(PDO::FETCH_BOTH);64 62 $num_refs= $sth->rowCount(); //quante pagine? 63 # $row = $sth->fetch(PDO::FETCH_BOTH); 65 64 } 66 65 if((($genere!=4) and $pag==0 and !$votog) or $genere==1 or $genere==2){ //diverso da liste a piu' candidati … … 73 72 $sth = $dbi->prepare("$sql"); 74 73 $sth->execute(); 75 $row = $sth->fetch(PDO::FETCH_BOTH);76 list($idg,$numg) = explode($row);74 # $row = $sth->fetch(PDO::FETCH_BOTH); 75 list($idg,$numg) = $sth->fetch(PDO::FETCH_BOTH); 77 76 $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 77 $sth = $dbi->prepare("$sql"); 79 78 $sth->execute(); 80 79 $num_sez = $sth->rowCount(); //quante sezioni? 80 $sezione=array(); 81 81 for ($i=1;$i<=$num_sez;$i++){ 82 $sezione[$i]== $sth->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni 82 $sezione[$i]=array(); 83 $sezione[$i]= $sth->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni 83 84 $ar[$i]=0; 84 85 } … … 127 128 // if ($genere>1 and $pag==1) $ops=3; 128 129 $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; 129 while ( $row = $sth->fetch(PDO::FETCH_BOTH)){130 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) = $sth->fetch(PDO::FETCH_NUM)){ 130 131 //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);132 132 // inserimento numeri di sez non scrutinate 133 133 while ($scrutinate < $num) { … … 141 141 $sth2 = $dbi->prepare("$sql"); 142 142 $sth2->execute(); 143 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 144 list ($gruppref) = explode($row2); 143 list ($gruppref) = $sth2->fetch(PDO::FETCH_NUM); 145 144 $tgrup_pref += $gruppref; 146 145 } … … 149 148 $sth2 = $dbi->prepare("$tab2"); 150 149 $sth2->execute(); 151 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 152 list($votid,$votiu,$voti) = explode($row2); 150 list($votid,$votiu,$voti) = $sth2->fetch(PDO::FETCH_NUM); 153 151 // $voti=$votiu+$votid; 154 152 … … 185 183 $sth2 = $dbi->prepare("select stato_lis from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id'"); 186 184 $sth2->execute(); 187 $row2 = $sth2->fetch(PDO::FETCH_BOTH); 188 list($crlis) = explode($row2); 185 list($crlis) = $sth2->fetch(PDO::FETCH_NUM); 189 186 190 187 if ($voti==$controllo1 and $validi==$controllo2 and !$g_err and $crlis!=-1){ -
trunk/admin/modules/Elezioni/ele.php
r257 r258 59 59 60 60 include ("header.php"); 61 # include("modules/Elezioni/testa.php"); 61 62 //immagine bullet 62 63 $bullet="<img src=\"temi/$tema/images/bullet.gif\" alt =\" \" align=\"left\" border=\"0\">"; … … 291 292 ele(); 292 293 global $language; 293 include("language/$ language/ele.html");294 include("language/$currentlang/ele.html"); 294 295 echo"</td></tr></table>"; 295 296 include("footer.php"); -
trunk/admin/modules/Elezioni/ele_associazioni.php
r257 r258 252 252 echo "</td></tr></table></form>"; 253 253 echo "<hr><br><table width=\"100%\" border=\"3\">"; 254 echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA." TEST:$id_cons_comu</b></td>";254 echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>"; 255 255 echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 256 256 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>"; … … 325 325 $delcons=0; 326 326 if ($do !="" and $id_cons_gen>0 and $idcomunenew>0) { 327 $sql="SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'"; 327 $sql="SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'"; 328 328 $rescomu = $dbi->prepare("$sql"); 329 329 $rescomu->execute(); … … 351 351 if ($idcomunenew>0) $newid=", id_comune = $idcomunenew "; 352 352 else $newid=''; 353 $result = mysql_query("update ".$prefix."_ele_comu_collegi set id_collegio= '$id_collegio' $newid where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi) || die(mysql_error()); 354 $result = $dbi->prepare("$sql"); 355 $result->execute(); 356 if (!$result->rowCount()) return; 353 $sql="update ".$prefix."_ele_comu_collegi set id_collegio= '$id_collegio' $newid where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'"; 354 $result = $dbi->prepare("$sql"); 355 $result->execute(); 357 356 $sql="update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze',id_fascia='$idfascia',vismf='$vismf',solo_gruppo='$sg',disgiunto='$disgiunto' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'"; 358 357 $result = $dbi->prepare("$sql"); -
trunk/admin/modules/Elezioni/ele_candidato.php
r257 r258 61 61 62 62 function all() { 63 global $ param, $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $id_cons,$tipo_cons,$id_lista,$genere,$id_cons_gen,$id_comune,$id_cand,$id_circ,$id_gruppo;63 global $do, $param, $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $id_cons,$tipo_cons,$id_lista,$genere,$id_cons_gen,$id_comune,$id_cand,$id_circ,$id_gruppo; 64 64 #patch per bloccare il submit se non e' stata scelta la lista. Proposta da margottid 65 65 echo "<script language=\"Javascript\">\n … … 157 157 $result = $dbi->prepare("$query"); 158 158 $result->execute(); 159 # list($id_lista)=$result->fetch(PDO::FETCH_NUM);160 159 if($cons_circ) 161 160 $sql = "SELECT count(0) FROM ".$prefix."_ele_candidati as t1,".$prefix."_ele_lista as t2 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons and t2.id_circ=$id_circ and t1.id_lista=t2.id_lista $cond "; … … 164 163 $sth = $dbi->prepare("$sql"); 165 164 $sth->execute(); 166 list($max) = $sth-> rowCount();165 list($max) = $sth->fetch(PDO::FETCH_NUM); 167 166 if($id_lista){ 168 167 $numero=$max+1;} else $numero=''; … … 290 289 $sth = $dbi->prepare("$sql"); 291 290 $sth->execute(); 292 if (!$result->rowCount())return;293 291 Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&id_lista=$id_lista&min=$min"); 294 292 } … … 315 313 $sth = $dbi->prepare("$sql"); 316 314 $sth->execute(); 317 if (!$result) return; 318 Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); 315 Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); 319 316 } else { 320 317 ele(); … … 341 338 $sth = $dbi->prepare("$sql"); 342 339 $sth->execute(); 343 if (!$result) {return;} 344 # Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); 340 Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); 345 341 } 346 342 … … 349 345 350 346 351 echo "qui si if ($do and $do!='modify')"; 352 if ($do and $do!='modify'){ele(); 347 if ($do and $do!='modify'){ 353 348 candidato($ok, $do,$id_cand, $id_lista,$id_circ, $id_gruppo,$cognome, $nome, $note, $simbolo,$id_cand2,$num_cand); 354 349 } else { ele(); } 355 //if (!$do)ele(); 350 356 351 all(); 357 352 echo"</td></tr></table>"; -
trunk/admin/modules/Elezioni/ele_cons_comuni.php
r257 r258 161 161 if ($id_cons2) { 162 162 // copia circoscrizione 163 $ res=mysql_query("select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'", $dbi);163 $sql="select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'"; 164 164 $res = $dbi->prepare("$sql"); 165 $res->execute(); 165 $res->execute(); 166 166 while (list($id,$idcirc,$num,$des2)=$res->fetch(PDO::FETCH_NUM)){ 167 167 $des=addslashes($des2); … … 188 188 $ind=addslashes($ind2); 189 189 $sql="select count(0) from ".$prefix."_ele_sede where id_cons='$id_cons2' and indirizzo='$ind'"; 190 $ress wdnew = $dbi->prepare("$sql");190 $ressednew = $dbi->prepare("$sql"); 191 191 $ressednew->execute(); 192 192 list($contr_sed)=$ressednew->fetch(PDO::FETCH_NUM); -
trunk/admin/modules/Elezioni/ele_lista.php
r257 r258 231 231 $result = $dbi->prepare("$sql"); 232 232 $result->execute(); 233 if (!$result->rowCount())return;234 233 Header("Location: admin.php?op=lista&id_circ=$id_circ&id_cons_gen=$id_cons_gen&min=$min"); 235 234 } … … 252 251 $result = $dbi->prepare("$sql"); 253 252 $result->execute(); 254 if (!$result->rowCount()) return;255 253 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen"); 256 254 } else { … … 278 276 $result = $dbi->prepare("$sql"); 279 277 $result->execute(); 280 if (!$result->rowCount()) return;281 278 Header("Location: admin.php?op=lista&id_circ=$id_circ&min=$min&id_cons_gen=$id_cons_gen"); 282 279 } -
trunk/admin/modules/Elezioni/ele_riepilogo.php
r257 r258 81 81 $res->execute(); 82 82 while (list($si,$no,$validi,$nulli,$bianchi,$contestati,$idg) = $res->fetch(PDO::FETCH_NUM)){ 83 $sql="SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'" , $dbi);83 $sql="SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'"; 84 84 $resref = $dbi->prepare("$sql"); 85 85 $resref->execute(); -
trunk/admin/modules/Elezioni/ele_sede.php
r257 r258 86 86 echo "<td align=\"right\"><select name=\"id_circ\">"; 87 87 $sql= "SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ"; 88 $res = $dbi->prepare("$sql"); 88 $res = $dbi->prepare("$sql");echo $sql; 89 89 $res->execute(); 90 90 while(list($id,$descr) = $res->fetch(PDO::FETCH_NUM)) { -
trunk/admin/modules/Elezioni/ele_voti.php
r257 r258 264 264 265 265 if($res3->rowCount() and !$votog){#$status=0;$ops=-4; 266 list($votigs,$votisolog) = m$res3->fetch(PDO::FETCH_NUM);266 list($votigs,$votisolog) = $res3->fetch(PDO::FETCH_NUM); 267 267 if($votigs and $genere!=2) { 268 268 # $status=0; … … 319 319 320 320 321 $ res4= mysql_query("SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";321 $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')"; 322 322 $res4 = $dbi->prepare("$sql"); 323 323 $res4->execute(); … … 449 449 } 450 450 } 451 $sql="SELECT num_sez, id_sez ,id_sede FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $solosede order by num_sez";451 $sql="SELECT num_sez, id_sez ,id_sede,colore FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $solosede order by num_sez"; 452 452 $res = $dbi->prepare("$sql"); 453 453 $res->execute(); … … 461 461 462 462 echo "<div id=\"navmenu\"> <ul>"; 463 while(list($sez_num, $sez_id ,$sede_id ) = $res->fetch(PDO::FETCH_NUM)) {463 while(list($sez_num, $sez_id ,$sede_id,$cursez) = $res->fetch(PDO::FETCH_NUM)) { 464 464 $ops=''; 465 465 if(!$id_sez) {$id_sez=$sez_id; $id_sede=$sede_id;} 466 466 $i++; 467 $ result = mysql_query("SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ";467 $sql="SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' "; 468 468 $result = $dbi->prepare("$sql"); 469 469 $result->execute(); … … 471 471 472 472 list($circ_id) = $result->fetch(PDO::FETCH_NUM); 473 /* 473 474 //colora la sezione 474 475 $sezstat=0; #die($ops); … … 507 508 508 509 if ($sezstat) $ops=abs($sezstat); else $ops=1; 509 510 */ 510 511 if(!$ops) $ops=1; 511 512 $sql="SELECT num_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'"; … … 515 516 516 517 list($numero_sez) = $res2->fetch(PDO::FETCH_NUM); 517 if ($sez_num==$numero_sez) {$cursez.= " border: solid; border-color: YELLOW; border-width: 4px; border-left: solid gray 4px; border-top: solid gray 4px; \"";} else $cursez.="\"";518 if ($sez_num==$numero_sez) {$cursez.= " border: solid; border-color: YELLOW; border-width: 4px; border-left: solid gray 4px; border-top: solid gray 4px; \"";} else $cursez.=" \""; 518 519 echo "\n<li $cursez><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$circ_id&id_sede=$sede_id&id_sez=$sez_id&ops=$ops&do=spoglio&id_lista=$id_lista\">$sez_num</a></b></li>\n"; 519 520 } … … 650 651 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = $result->fetch(PDO::FETCH_NUM); 651 652 652 echo "<hr><table><tr><td width=\"200\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione N. $num_sez</b></font size></td><td><table><tr>";653 echo "<hr><table><tr><td width=\"200\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione N. $num_sez</b></font></td><td><table><tr>"; 653 654 echo "\n<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=1\">"._AFFLUENZE."</a></b></p></td>\n"; 654 655 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){ … … 768 769 } 769 770 ####### 770 if(!$votog and ($genere==3 or $genere==5)) 771 if(!$votog and ($genere==3 or $genere==5)){ 771 772 $sql="select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' "; 772 773 $result = $dbi->prepare("$sql"); … … 774 775 775 776 776 else 777 }else{ 777 778 $sql="select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' "; 778 779 $result = $dbi->prepare("$sql"); 779 780 $result->execute(); 780 781 } 781 782 782 783 list($validi,$nulli,$bianchi,$contestati,$votinulli) = $result->fetch(PDO::FETCH_NUM); … … 799 800 } 800 801 echo "<td> </td></tr><tr><td style=\"vertical-align: top;\">"; 801 echo "<form name=\"liste\" action=\" admin.php\">";802 echo "<form name=\"liste\" action=\"modules/Elezioni/salva_liste.php\">"; 802 803 echo "<input type=\"hidden\" name=\"pag\" value=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3&id_lista=\">"; 803 804 echo "<select name=\"id_lista\" size=\"".($num_liste+1)."\" onChange=\"vai_lista()\">"; … … 825 826 826 827 list($votisezcand)=$result->fetch(PDO::FETCH_NUM); 827 if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4) 828 if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4){ 828 829 $sql="SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'"; 829 830 $result = $dbi->prepare("$sql"); 830 831 $result->execute(); 831 832 833 else{ 834 832 }else{ 835 833 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'"; 836 834 $result = $dbi->prepare("$sql"); 837 835 $result->execute(); 838 839 840 836 list($id_gruppo)=$result; 841 837 $sql="SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'"; 842 838 $result = $dbi->prepare("$sql"); 843 839 $result->execute(); 844 845 846 840 } 847 841 list($votisezlis,$sgpl)=$result->fetch(PDO::FETCH_NUM); … … 871 865 872 866 if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";} 873 if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) 867 if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) { 874 868 $sql="SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,0,0,0 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez=$id_sez group by t1.id_sez"; 875 869 $result = $dbi->prepare("$sql"); … … 877 871 878 872 879 else 873 }else{ 880 874 $sql="SELECT sum(t1.voti),t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez='$id_sez' group by t1.id_sez"; 881 875 $result = $dbi->prepare("$sql"); 882 876 $result->execute(); 883 877 } 884 878 885 879 // aggiunte le variabili $sgpl e $vnulli2 per la gestione dei voti 1) al solo presidente per singola lista - 2) al solo presidente per singola lista perché nullo o contestato quello di lista … … 917 911 918 912 list($votisezcand)=$result->fetch(PDO::FETCH_NUM); 919 if(($fascia>$limite or $disgiunto) or !$id_conf) 913 if(($fascia>$limite or $disgiunto) or !$id_conf){ 920 914 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'"; 921 915 $result = $dbi->prepare("$sql"); … … 923 917 924 918 925 else{919 }else{ 926 920 927 921 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'"; … … 951 945 952 946 953 $ res4= mysql_query("SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";947 $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'"; 954 948 $res4 = $dbi->prepare("$sql"); 955 949 $res4->execute(); … … 1000 994 1001 995 1002 echo "\n<form name=\"sezioni\" action=\" admin.php\">"996 echo "\n<form name=\"sezioni\" action=\"modules/Elezioni/salva_liste.php\">" 1003 997 ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">" 1004 998 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">" 999 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">" 1005 1000 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">" 1006 1001 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">" … … 1066 1061 ."<td align=\"left\"><b>$cognome $nome</b></td>"; 1067 1062 $cond_sele="and id_cand=$id_cand"; 1068 $sql="SELECT *FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele";1069 $res = $dbi->prepare("$sql"); 1070 $res->execute(); 1071 1072 1073 $pro= $res->fetch(PDO::FETCH_BOTH);1063 $sql="SELECT voti FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele"; 1064 $res = $dbi->prepare("$sql"); 1065 $res->execute(); 1066 1067 1068 list($voti)= $res->fetch(PDO::FETCH_NUM); 1074 1069 if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor=''; 1075 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$ pro['voti']."\" size=\"7\" style=\"text-align:right\">";1070 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">"; 1076 1071 echo "<input type=\"hidden\" name=\"id_cand$i\" value=\"$id_cand\"></td></tr>\n"; 1077 1072 $i++; 1078 $tot_pref+=$ pro['voti'];1073 $tot_pref+=$voti; 1079 1074 } 1080 1075 }else { 1081 $sql="select t2.voti,t1.id_lista, descrizione,simbolo, num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo1076 $sql="select t2.voti,t1.id_lista, descrizione,simbolo,t1.num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo 1082 1077 from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2 1083 1078 where t1.id_cons='$id_cons' … … 1085 1080 and t2.id_sez=$id_sez 1086 1081 order by t1.num_lista"; 1087 $result1 = $dbi->prepare("$sql"); 1088 $result1->execute(); 1089 1082 1083 try { 1084 $result1 = $dbi->prepare("$sql"); 1085 $result1->execute(); 1086 1087 } 1088 catch(PDOException $e) 1089 { 1090 echo $sql . "<br>" . $e->getMessage(); 1091 } 1090 1092 1091 1093 $num_lista=$result1->rowCount(); 1092 1094 if (!$num_lista){ 1093 $sql="select ' ',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo1095 $sql="select '0',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo 1094 1096 from ".$prefix."_ele_lista where id_cons='$id_cons' $circo 1095 1097 order by num_lista"; … … 1099 1101 1100 1102 } 1101 while (list($ pro['voti'],$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){1103 while (list($voti,$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){ 1102 1104 echo "<tr bgcolor=\"$bgcolor2\">"; 1103 1105 // if ($genere<4 or $votoc){ … … 1108 1110 ."<td align=\"left\"><b> $descr_lista</b></td>"; 1109 1111 $cond_sele="and id_lista=$id_lista3"; 1110 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$ pro['voti']."\" size=\"7\" style=\"text-align:right\">";1112 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">"; 1111 1113 if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19) echo "</td><td align=\"right\"><input name=\"vnpl$i\" value=\"".$vnpl."\" size=\"7\" style=\"text-align:right\">"; 1112 1114 if($disgiunto) echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\">"; … … 1115 1117 echo "</tr>\n"; 1116 1118 $i++; 1117 $tot_pref+=$ pro['voti'];1119 $tot_pref+=$voti; 1118 1120 } 1119 1121 } … … 1154 1156 echo "<td></td><td></td>"; 1155 1157 echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>"; 1156 echo "</tr></table> </form></tr>";1158 echo "</tr></table>"; 1157 1159 if(chisei($id_cons_gen)>=64){ 1158 echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\" \" onclick=\"javascript:del_dati()\">"._DELETE."</td>";1159 } 1160 echo "</ table>";1160 echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"1\">"._DELETE."</td>"; 1161 } # onclick=\"javascript:del_dati()\" 1162 echo "</form></tr></table>"; 1161 1163 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n" 1162 1164 ."document.sezioni.voti1.focus()\n" … … 1179 1181 global $prefix, $dbi,$aid,$id_cons,$ops,$genere,$votog,$fileout,$id_comune,$limite,$update,$dettnulli,$disgiunto,$tipo_cons; 1180 1182 1181 $sqlcomu="select id_fascia,id_conf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"; 1182 $sql=$sqlcomu); 1183 $sql="select id_fascia,id_conf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"; 1183 1184 if($res) 1184 1185 list($fascia,$id_conf)=$res->fetch(PDO::FETCH_NUM); … … 1190 1191 $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']); 1191 1192 $arg2 = func_get_args(); 1192 $arg = split(",",$arg2[0]);1193 $arg = preg_split("/\,+/",$arg2[0]); 1193 1194 $id_cons_gen=intval($arg[1]); 1194 1195 $id_sez = intval($arg[2]); … … 1302 1303 1303 1304 1304 if($valista) 1305 if($valista) { 1305 1306 $sql="update ".$prefix."_ele_sezioni set validi_lista='$valista' where id_sez='$id_sez'"; 1306 1307 $res = $dbi->prepare("$sql"); … … 1308 1309 1309 1310 1310 else1311 }else{ 1311 1312 $sql="update ".$prefix."_ele_sezioni set validi_lista=(`validi`-`solo_gruppo`-`voti_nulli_lista`-`contestati_lista`) where id_sez='$id_sez'"; 1312 1313 $res = $dbi->prepare("$sql"); 1313 $res->execute(); 1314 $res->execute();} 1314 1315 1315 1316 … … 1333 1334 function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){ 1334 1335 //function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){ 1335 global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen ;1336 global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$id_comune; 1336 1337 $bgcolor1=$_SESSION['bgcolor2']; 1337 OpenTable(); 1338 1339 #OpenTable(); 1338 1340 $sql="SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"; 1339 1341 $res = $dbi->prepare("$sql"); … … 1346 1348 $res->execute(); 1347 1349 1348 1350 echo "<table><tr><td>"; 1349 1351 $num = $res->rowCount(); 1350 1352 $sql="SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez"; 1351 1353 $ressez = $dbi->prepare("$sql"); 1352 1354 $ressez->execute(); 1353 1355 ################## 1356 echo "<style>"; 1357 echo "DIV.table"; 1358 echo "{ 1359 display:table; 1360 } 1361 FORM.tr 1362 { 1363 display:table-row; 1364 text-align: center; 1365 } 1366 DIV.tr 1367 { 1368 display:table-row; 1369 background-color: #D3D3D3; 1370 text-align: center; 1371 } 1372 SPAN.tdm 1373 { 1374 display:table-cell; 1375 border: 1px solid black; 1376 padding: 5px; 1377 } 1378 SPAN.td 1379 { 1380 display:table-cell; 1381 }"; 1382 echo "</style>"; 1383 1384 /* 1385 echo "<form class=\"tr\" name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">"; 1386 echo "<span class=\"td\"><input type=\"text\"/></span>"; 1387 <span class="td"><input type="text"/></span> 1388 </form> 1389 <div class="tr"> 1390 <span class="td">(cell data)</span> 1391 <span class="td">(cell data)</span> 1392 </div> 1393 ... 1394 </div> 1395 */ 1396 ################## 1354 1397 1355 1398 list($maschi,$femmine)=$ressez->fetch(PDO::FETCH_NUM); 1356 1399 $y=0; 1357 echo "<tr><td> </td></tr>"; 1400 echo "<div class=\"table\">"; 1401 #echo "<tr><td> </td></tr>"; 1402 $riga=array(); 1403 $rigat=array(); 1358 1404 while (list($ora,$giorno)= $res->fetch(PDO::FETCH_NUM)){ 1359 1405 $y++; 1360 echo "\n<tr><td>"; 1361 echo "<form name=\"votanti$y\" action=\"admin.php\">"; 1362 echo "<table class=\"table-menu\" style=\"width: 100%; color: black;\"><tr>"; 1363 if ($genere==0){ //e' un referendum 1364 echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></td>"; 1365 } 1366 echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></td>" 1367 ."<td bgcolor=\"$bgcolor1\" align=\"center\"width=\"32\"><b>"._DATA."</b></td>"; 1368 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></td>"; 1369 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></td>" 1370 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b>"; 1406 $rigat[$y]=''; 1407 $riga[$y]=''; 1408 # echo "\n<tr><td>"; 1409 # echo "<form name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">"; 1410 # echo "<table class=\"table-menu\" style=\"width: 100%; color: black;\"><tr>"; 1411 $rigat[$y]= "<div class=\"tr\">"; 1412 if ($genere==0){ //e' un referendum 1413 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></td>"; 1414 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></span>"; 1415 } 1416 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></span>" 1417 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._DATA."</b></span>"; 1418 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></span>"; 1419 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></span>" 1420 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b></span>"; 1371 1421 if ($genere==0){ 1372 1422 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' "; … … 1375 1425 1376 1426 1377 $max = $res2_>rowCount(); 1378 }else{ $max=1;} 1379 echo "<input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\">"; 1380 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">" 1381 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">" 1382 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">" 1383 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"; 1384 echo "</td>"; //la riga viene chiusa nel ciclo for 1427 $max = $res2->rowCount(); 1428 }else{ $max=1;} $op="rec_add_votanti"; 1429 $rigat[$y].= "</div>"; 1430 1385 1431 for ($i=1;$i<=$max;$i++){ 1386 1432 $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2 … … 1396 1442 1397 1443 list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = $result->fetch(PDO::FETCH_NUM); 1398 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo= $id_gruppo";1444 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo' "; 1399 1445 $res2 = $dbi->prepare("$sql"); 1400 1446 $res2->execute(); 1401 1447 1402 1448 1403 $ resril = mysql_query("select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'";1449 $sql="select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'"; 1404 1450 $resril = $dbi->prepare("$sql"); 1405 1451 $resril->execute(); … … 1425 1471 $precede[$id_gruppo]=$voti_t; 1426 1472 if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){ 1427 echo "</tr><tr style=\"background-color: rgb(255, 0, 0); text-align: center\">"; $error=0; 1473 # echo "</tr><tr styl.e=\"background-color: rgb(255, 0, 0); text-align: center\">"; $error=0; 1474 $riga[$y].= "<form class=\"tr\" style=\"background-color: rgb(255, 0, 0); text-align: center\" name=\"votanti\" action=\"modules/Elezioni/salva_aff.php\">"; 1428 1475 }else{ 1429 echo "</tr><tr class=\"tr-dx\">";1476 $riga[$y].= "<form class=\"tr\" action=\"modules/Elezioni/salva_aff.php\">"; 1430 1477 } 1431 1478 if ($genere==0){ // e' un referendum 1432 echo "<td align=\"center\">$gruppo</td>"; 1433 } 1434 1435 list ($anno,$mese,$di)=explode('-',$giorno); 1436 echo "<td align=\"center\">$ora</td><td align=\"center\">$di-$mese-$anno</td>"; 1437 if ($voti_u > $maschi) echo "<td align=\"center\" bgcolor=\"red\">"; 1438 else echo "<td align=\"center\">"; 1439 if ($y<$num and $vismf==0 and $voti_u==0) { echo "<input type=\"hidden\"";}else echo "<input type=\"text\" style=\"text-align:right\""; 1440 echo " name=\"voti_u$i\" value=\"$voti_u\" size=\"5\"></td>"; 1441 if ($voti_d > $femmine) echo "<td align=\"center\" bgcolor=\"red\">"; 1442 else echo "<td align=\"center\">"; 1443 if ($y<$num and $vismf==0 and $voti_d==0) { echo "<input type=\"hidden\"";}else echo "<input type=\"text\" style=\"text-align:right\""; 1444 echo " name=\"voti_d$i\" value=\"$voti_d\" size=\"5\"></td>"; 1445 if ($voti_t > ($maschi+$femmine)) echo "<td align=\"center\" bgcolor=\"red\"><input type=\"text\" name=\"voti_t$i\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\">"; 1446 else echo "<td align=\"center\"><input name=\"voti_t$i\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\">"; 1447 echo "<input type=\"hidden\" name=\"id_parz$i\" value=\"$id_parz\">" 1448 ."<input type=\"hidden\" name=\"data$i\" value=\"$giorno\">" 1449 ."<input type=\"hidden\" name=\"orario$i\" value=\"$ora\">" 1450 ."<input type=\"hidden\" name=\"gruppo$i\" value=\"$id_gruppo\">"; 1451 echo "</td>"; 1452 } 1453 if (chisei($id_cons_gen)>=64 and $y==$numril) echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"></td>"; 1454 else echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"></td>"; 1455 echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"></td>"; 1456 echo "</tr>"; 1457 1458 1459 1460 # echo "</table></form></td></tr>"; 1461 echo "</table></form>"; 1479 $riga[$y].= "<span class=\"td\" align=\"center\">$gruppo</span>"; 1480 } 1481 1482 1483 $riga[$y].= "<span class=\"td\"><input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\"/>"; 1484 $riga[$y].= "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>" 1485 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"/>" 1486 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"/>" 1487 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\"/>"; 1488 #$riga[$y].= "</span>"; 1489 list ($anno,$mese,$di)=explode('-',$giorno); 1490 $riga[$y].= "$ora</span><span class=\"td\" align=\"center\">$di-$mese-$anno</span>"; 1491 if ($voti_u > $maschi) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">"; 1492 else $riga[$y].= "<span class=\"td\" align=\"center\">"; 1493 if ($y<$num and $vismf==0 and $voti_u==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"'$voti_u'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"$voti_u\""; 1494 $riga[$y].= " size=\"5\"/></span>"; 1495 if ($voti_d > $femmine) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\"/>"; 1496 else $riga[$y].= "<span class=\"td\" align=\"center\">"; 1497 if ($y<$num and $vismf==0 and $voti_d==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"'$voti_d'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"$voti_d\""; 1498 $riga[$y].= " size=\"5\"/></span>"; 1499 if ($voti_t > ($maschi+$femmine)) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\" ><input type=\"text\" id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>"; 1500 else $riga[$y].= "<span class=\"td\" align=\"center\"><input id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>"; 1501 $riga[$y].= "<input type=\"hidden\" name=\"id_parz\" value=\"$id_parz\"/>" 1502 ."<input type=\"hidden\" name=\"data\" value=\"$giorno\"/>" 1503 ."<input type=\"hidden\" name=\"orario\" value=\"$ora\"/>" 1504 ."<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>" 1505 ."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>"; 1506 $riga[$y].= "</span>"; 1507 1508 if (chisei($id_cons_gen)>=64 and $y==$numril) $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>"; 1509 else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>"; 1510 $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>"; 1511 $riga[$y].= "</form>"; 1512 1513 } 1514 # echo "</table></form>"; 1515 echo "</div>"; 1516 1517 1462 1518 $sql="select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez"; 1463 1519 $compl = $dbi->prepare("$sql"); … … 1469 1525 { 1470 1526 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"; 1471 if ($y==$num) { 1472 echo "document.votanti$y.voti_u1.focus()\n"; 1473 echo "document.votanti$y.voti_u1.select()\n"; 1527 $numy=$y.'1'; 1528 if ($y==$num) { 1529 echo "document.votanti$y.voti_u$numy.focus()\n"; 1530 echo "document.votanti$y.voti_u$numy.select()\n"; 1474 1531 }else{ 1475 echo " document.votanti$y.voti_t1.focus()\n";1476 echo " document.votanti$y.voti_t1.select()\n";1532 echo "this.voti_t$numy.focus()\n"; 1533 echo "this.voti_t$numy.select()\n"; 1477 1534 } 1478 1535 echo "//-->\n" … … 1480 1537 break; 1481 1538 } 1482 echo "</td></tr>"; 1483 } 1484 CloseTable(); 1485 } 1486 1487 1488 /////////////////////////// 1489 // registra i votanti 1490 /////////////////////////// 1491 1492 function rec_add_votanti() { 1493 global $prefix, $dbi,$aid,$tipo_cons,$genere,$id_cons,$fileout; 1494 //ordine dei parametri: 0)op 1)voti_u 2) voti_d 3)voti_t 4)id_cons 5)id_sez 6)id_circ 7)id_sede 1495 // 8)id_parz 9)ops 10)data 11)orario 12)tipo 13)id_gruppo 14) update 1496 if ($fileout) while (!$fp = fopen($fileout,"a")); 1497 1498 $username="$aid"; 1499 $arg2 = func_get_args(); 1500 $arg = split(",",$arg2[0]); 1501 $id_cons_gen=intval($arg[1]); 1502 $id_sez=intval($arg[2]); 1503 $id_circ=intval($arg[3]); 1504 $id_sede=intval($arg[4]); 1505 $op=$arg[count($arg)-2]; 1506 for($i=5;$i< count($arg)-2;) { 1507 $voti_u = intval($arg[$i++]); 1508 $voti_d = intval($arg[$i++]); 1509 $voti_t = intval($arg[$i++]); 1510 if($voti_t==0) $voti_t=$voti_d+$voti_u; 1511 $id_parz = intval($arg[$i++]); 1512 $giorno = $arg[$i++]; 1513 $ora = $arg[$i++]; 1514 $id_gruppo = intval($arg[$i++]); 1515 $data=date("Y/m/d"); 1516 $tempo=date("H:i:s"); 1517 $sql="delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'"; 1518 $res = $dbi->prepare("$sql"); 1519 $res->execute(); 1520 1521 1522 $query="select * from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez='$id_sez'"; 1523 if ($genere==0){ 1524 $query.=" and id_gruppo=$id_gruppo"; 1525 } 1526 $sql="$query"; 1527 $res = $dbi->prepare("$sql"); 1528 $res->execute(); 1529 1530 1531 $righe=$res->rowCount(); 1532 if (!$righe){ 1533 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$data','$tempo','','id_parz:$id_parz ora: $ora data:$giorno voti uomini:$voti_u donne:$voti_d totali:$voti_t id_gruppo:$id_gruppo','".$prefix."_ele_voti_parziale')"; 1534 $res = $dbi->prepare("$sql"); 1535 $res->execute(); 1536 1537 1538 $sql="insert into ".$prefix."_ele_voti_parziale values ('$id_cons', '$id_sez','$id_parz','$ora','$giorno','$voti_u','$voti_d','$voti_t','$id_gruppo')"; 1539 $res = $dbi->prepare("$sql"); 1540 $res->execute(); 1541 1542 1543 if ($fileout) fwrite($fp,"insert into ".$prefix."_ele_voti_parziale values ('$id_cons', '$id_sez','$id_parz','$ora','$giorno','$voti_u','$voti_d','$voti_t','$id_gruppo');\n"); 1544 } elseif($op=="true"){ 1545 $sql="delete from ".$prefix."_ele_voti_parziale where id_parz='$id_parz'"; 1546 $res = $dbi->prepare("$sql"); 1547 $res->execute(); 1548 1549 1550 if ($fileout) fwrite($fp,"delete from ".$prefix."_ele_voti_parziale where id_parz='$id_parz';\n"); 1551 } else { 1552 $sql="select * from ".$prefix."_ele_voti_parziale where id_parz=$id_parz"; 1553 $res = $dbi->prepare("$sql"); 1554 $res->execute(); 1555 1556 1557 $ar=$res->fetch(PDO::FETCH_BOTH); 1558 1559 if ($ar['voti_uomini']!=$voti_u or $ar['voti_donne']!=$voti_d or $ar['voti_complessivi']!=$voti_t){ 1560 $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$data','$tempo','ora:$ar[3] data:$ar[4] voti uomini:$ar[5] donne:$ar[6] totali:$ar[7] gruppo:$ar[8]','id_parz:$id_parz ora: $ora data:$giorno voti uomini:$voti_u donne:$voti_d totali:$voti_t id_gruppo:$id_gruppo','".$prefix."_ele_voti_parziale')"; 1561 $res = $dbi->prepare("$sql"); 1562 $res->execute(); 1563 1564 1565 $sql="update ".$prefix."_ele_voti_parziale set voti_uomini='$voti_u', voti_donne='$voti_d', voti_complessivi='$voti_t' where id_parz='$id_parz'"; 1566 $res = $dbi->prepare("$sql"); 1567 $res->execute(); 1568 1569 1570 if ($fileout) fwrite($fp,"update ".$prefix."_ele_voti_parziale set voti_uomini='$voti_u', voti_donne='$voti_d', voti_complessivi='$voti_t' where id_parz='$id_parz';\n"); 1571 } 1572 } 1573 } 1574 if ($fileout)fclose($fp); 1575 Header("Location: admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&ops=1&do=spoglio"); 1539 # echo "</td></tr>"; 1540 } 1541 #CloseTable(); 1542 foreach($riga as $key=>$val){ 1543 echo $rigat[$key]; 1544 echo $riga[$key]; 1545 } 1546 echo "</div></td></tr></table>"; 1576 1547 } 1577 1548 … … 1588 1559 1589 1560 1590 echo "<form name=\"spogliovoti\" action=\" admin.php\">"1561 echo "<form name=\"spogliovoti\" action=\"modules/Elezioni/salva_voti.php\">" 1591 1562 ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">"; 1592 1563 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">" 1564 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">" 1593 1565 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">" 1594 1566 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">" … … 1638 1610 ."</td><td>$tot_nulli" 1639 1611 ."</td><td>$tot_voti</td><td>" 1640 // ."<input type=\"hidden\" name=\"id_cand\" value=\"$id_cand\">"1612 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">" 1641 1613 ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">" 1642 1614 ."<input type=\"submit\" name=\"update\" value=\""._OK."\">" … … 1800 1772 1801 1773 1802 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM)1774 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM); 1803 1775 echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">" 1804 1776 ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>" … … 1950 1922 echo "<tr><td></td></tr></table>"; 1951 1923 if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) { 1952 echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"admin.php\">"; 1953 echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppi\">" 1924 if($genere==0) echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_ref.php\">"; 1925 else echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_gruppi.php\">"; 1926 echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppiq\">" 1954 1927 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">" 1928 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">" 1955 1929 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">" 1956 1930 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">" 1957 1931 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">" 1932 ."<input type=\"hidden\" name=\"circo\" value=\"$circo\">" 1933 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">" 1958 1934 ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">"; 1959 1935 echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">" … … 2018 1994 echo "<td align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>" 2019 1995 ."</td><td align=\"left\" width=\"50%\"><b> $descr[0] </b>"; 2020 $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:' ';2021 $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:' ';2022 $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:' ';2023 $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:' ';2024 $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:' ';2025 $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:' ';1996 $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'0'; 1997 $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'0'; 1998 $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'0'; 1999 $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'0'; 2000 $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'0'; 2001 $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'0'; 2026 2002 $tot_nulli=$pro['nulli']+$pro['bianchi']+$pro['contestati']; 2027 2003 $tot_voti=$pro['validi']+$tot_nulli; … … 2036 2012 echo "</td><td align=\"right\">$tot</td>"; 2037 2013 }else{ 2038 echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\" id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>"2014 echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"num_gruppo$i\" value=\"$num_gruppo\"><b>$num_gruppo</b>" 2039 2015 ."</td><td align=\"left\"><b> $descr_gruppo </b>"; 2040 2016 $sql="SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' "; … … 2108 2084 $log_ora=getdate(time()); 2109 2085 $arg2 = func_get_args(); 2110 $arg = split(",",$arg2[0]);2086 $arg = preg_split("/\,+/",$arg2[0]); 2111 2087 $id_cons_gen=intval($arg[1]); 2112 2088 $id_sez = intval($arg[2]); … … 2278 2254 voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista); 2279 2255 break; 2256 case "rec_add_votanti": 2257 rec_add_votanti($vari); 2258 break; 2280 2259 default : 2281 2260 $op($vari); //chiamata a funzione variabile con parametri variabili (da cambiare!)
Note:
See TracChangeset
for help on using the changeset viewer.