Changeset 262 for trunk/admin/modules/Elezioni/salva_aff.php
- Timestamp:
- Apr 7, 2019, 5:16:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/salva_aff.php
r258 r262 37 37 if (isset($_GET['id_comune'])) $id_comune=intval($_GET['id_comune']); else $id_comune='0'; 38 38 if (isset($_GET['id_gruppo'])) $id_gruppo=intval($_GET['id_gruppo']); else $id_gruppo='0'; 39 if (isset($_GET['genere'])) $genere=intval($_GET['genere']); else $genere='0'; 39 40 if (isset($_GET['delete'])) get_magic_quotes_gpc() ? $delete=$_GET['delete']:$delete=addslashes($_GET['delete']); else $delete=''; 40 41 global $prefix,$id_parz,$tempo,$username,$aid,$dbi,$genere; 41 /* ############42 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ";43 $res = $dbi->prepare("$sql");44 $res->execute();45 $num = $res->rowCount();46 $y=0;47 while(list($i,$a)=$result->fetch(PDO::FETCH_BOTH)) {48 $y++;49 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";50 $res2 = $dbi->prepare("$sql");51 $res2->execute();52 for($i=1;$i<=$max;$i++){53 $idg="id_gruppo$i";$vnp="vnpl$i";$slp="slpl$i";$idlist="id_lista$i";54 if (isset($_GET[$vnp])) $vnpl[$i]=intval($_GET[$vnp]); else $vnpl[$i]='0';55 if (isset($_GET[$vot])) $voti[$i]=intval($_GET[$vot]); else $voti[$i]='0';56 if (isset($_GET[$slp])) $slpl[$i]=intval($_GET[$slp]); else $slpl[$i]='0';57 if (isset($_GET[$idlist])) $idlista[$i]=intval($_GET[$idlist]); else $idlista[$i]='0';58 $sololiste+=$slpl[$i];59 }60 }61 #############62 */63 42 64 43 if (!isset($fileout)) $fileout=''; … … 105 84 $res->execute(); 106 85 } 107 controllo_aff($id_cons,$id_sez,$id_parz); 86 #controllo_aff($id_cons,$id_sez,$id_parz); 87 include("ele_controlli.php"); 88 controllo_aff($id_cons,$id_sez,$id_parz); 89 include("ele_colora_sez.php"); 108 90 109 91 Header("Location: ".$BASE."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"); 110 92 111 93 112 function controllo_aff($id_cons,$id_sez,$id_parz){113 global $prefix,$dbi,$id_sede,$id_con_gen;114 ##############################115 # $sql="select * from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'";116 # $resc = $dbi->prepare("$sql");117 # $resc->execute();118 # $conta=$resc->rowCount();119 $err=0;120 # $err2=0;121 $sql="select maschi,femmine from ".$prefix."_ele_sezioni where id_sez='$id_sez'";122 $res = $dbi->prepare("$sql");123 $res->execute();124 list($maschi,$femmine)=$res->fetch(PDO::FETCH_NUM);125 126 $sql="select voti_uomini,voti_donne,voti_complessivi from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_parz='$id_parz'";127 $res = $dbi->prepare("$sql");128 $res->execute();129 while(list($voti_u,$voti_d,$voti_t)=$res->fetch(PDO::FETCH_NUM))130 if(($voti_u+$voti_d!=$voti_t || $voti_u>$maschi || $voti_d>$femmine) and ($voti_u+$voti_d>0)) {$err=1; break;}131 /* if($conta){132 $aff=$resc->fetch(PDO::FETCH_BOTH);133 if($aff['status'])134 if ($aff['stato_val'] || $aff['stato_lis'] || $aff['stato_gru'] || $aff['stato_can']) $err2=1;135 }136 if($conta && !$err2) {137 $sql="update ".$prefix."_ele_controllosez set stato_aff='$err',status='$err' where id_cons='$id_cons' and id_sez='$id_sez'";138 $res = $dbi->prepare("$sql");139 $res->execute();140 } elseif($conta && !$err){141 $sql="update ".$prefix."_ele_controllosez set stato_aff='$err' where id_cons='$id_cons' and id_sez='$id_sez'";142 $res = $dbi->prepare("$sql");143 $res->execute();144 return;145 } else {146 $sql="insert into ".$prefix."_ele_controllosez values ('$id_sez','$id_cons','$err','0','0','0','0','$err')";147 $res = $dbi->prepare("$sql");148 $res->execute();149 }*/150 #######################151 $tipo='affluenze';152 $sql="select id from ".$prefix."_ele_controlli where tipo='$tipo' and id_sez='$id_sez' ";153 $res = $dbi->prepare("$sql");154 $res->execute();155 $righe=$res->rowCount();156 if($righe){157 while(list($id)=$res->fetch(PDO::FETCH_NUM)){158 if($id==$id_parz){159 if(!$err){160 $sql="delete from ".$prefix."_ele_controlli where tipo='$tipo' and id='$id_parz' ";161 $res = $dbi->prepare("$sql");162 $res->execute();163 164 }165 $err=0;166 break;167 }168 }169 }170 if($err){171 $sql="insert into ".$prefix."_ele_controlli value('$id_cons','$id_sez','$tipo','$id_parz')";172 $res = $dbi->prepare("$sql");173 $res->execute();174 }175 176 177 #######################178 include("ele_colora_sez.php");179 }180 181 94 ?>
Note:
See TracChangeset
for help on using the changeset viewer.