Ignore:
Timestamp:
Jan 16, 2019, 7:06:35 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/controllo_voti.php

    r254 r256  
    2626$perms=ChiSei($id_cons_gen);
    2727if ($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);
    3338include("modules/Elezioni/funzionidata.php");
    3439include("modules/Elezioni/ele.php");
     
    4449 
    4550    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);
    4856        $totel=$totm+$totf;
    4957        if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina
    5058        if (!IsSet($num_ref)) {
    5159                $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?
    5465        }
    5566        if((($genere!=4) and $pag==0 and !$votog) or $genere==1 or $genere==2){ //diverso da liste a piu' candidati
     
    5970        }
    6071        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?
    6581for ($i=1;$i<=$num_sez;$i++){
    66                 $sezione[$i]=mysql_fetch_array($res, 3); //inizializza l'array delle sezioni
     82                $sezione[$i]== $sth->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni
    6783                $ar[$i]=0;
    6884        }
     
    88104                $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";
    89105        }
    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();
    92109        $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
    93110        $riga2 .= "<tr><td>\n<table border=\"0\" width=\"100%\"  align=\"center\">";
     
    106123//              $riga3 .= "<td><b>"._PREFLIS."</b></td>";
    107124        $riga3 .= "<td><b>"._STATO."</b></td></tr>\n";
    108         $res = mysql_query("$tab ", $dbi);//die($tab);
    109         $num_scr = mysql_num_rows($res);
    110125        $righe= "";
    111126        $scrutinate=1;
    112127//      if ($genere>1 and $pag==1) $ops=3;
    113128        $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);
    115132        // inserimento numeri di sez non scrutinate
    116133                while ($scrutinate < $num) {
     
    121138        // fine inserimento     
    122139                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);
    125145                        $tgrup_pref += $gruppref;
    126146                }
    127147                $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'";
    128148                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);
    131153//              $voti=$votiu+$votid;
    132154               
     
    161183                if($genere==5 and !$votog) #$validi+$nulli+$bianchi+$vcont+$vn
    162184                        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
    165190                if ($voti==$controllo1 and $validi==$controllo2 and !$g_err and $crlis!=-1){
    166191                        $righe .= "<td>"._OK."</td></tr>\n";
Note: See TracChangeset for help on using the changeset viewer.