Changeset 327 for trunk/admin/modules/Elezioni/salva_ref.php
- Timestamp:
- Feb 14, 2020, 5:32:35 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/salva_ref.php
r326 r327 43 43 44 44 global $prefix,$id_parz,$fileout; 45 $sql="select num_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo "; 46 $result = $dbi->prepare("$sql"); 47 $result->execute(); 48 while(list($i)=$result->fetch(PDO::FETCH_BOTH)) { 49 $gruv="id_gruppo$i";$siv="si$i";$nov="no$i";$valv="val$i";$biav="bia$i";$conv="con$i";$nulv="nul$i"; 50 if (isset($_GET[$gruv])) $id_gruppo[$i]=intval($_GET[$gruv]); else $id_gruppo[$i]='0'; 51 if (isset($_GET[$siv])) $si[$i]=intval($_GET[$siv]); else $si[$i]='0'; 52 if (isset($_GET[$nov])) $no[$i]=intval($_GET[$nov]); else $no[$i]='0'; 53 if (isset($_GET[$valv])) $val[$i]=intval($_GET[$valv]); else $val[$i]='0'; 54 if (isset($_GET[$biav])) $bia[$i]=intval($_GET[$biav]); else $bia[$i]='0'; 55 if (isset($_GET[$conv])) $con[$i]=intval($_GET[$conv]); else $con[$i]='0'; 56 if (isset($_GET[$nulv])) $nul[$i]=intval($_GET[$nulv]); else $nul[$i]='0'; 57 58 } 45 $sql="select num_gruppo,id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' ORDER BY num_gruppo "; 46 $resultg = $dbi->prepare("$sql"); 47 $resultg->execute(); 59 48 60 49 if (!isset($fileout)) $fileout=''; 61 #if(($voti_u+$voti_d) and !$voti_t) $voti_t=$voti_u+$voti_d; 50 62 51 if ($fileout) while (!$fp = fopen($fileout,"a")); 63 52 64 53 ################## 65 54 if($do==1) { 66 $sql="delete from ".$prefix."_ele_ gruppo where id_cons='$id_cons'";55 $sql="delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez=$id_sez"; 67 56 $res = $dbi->prepare("$sql"); 68 57 $res->execute(); 69 58 }else{ 59 while(list($i,$idgruppo)=$resultg->fetch(PDO::FETCH_BOTH)) { 60 $gruv="id_gruppo$i";$siv="si$i";$nov="no$i";$valv="val$i";$biav="bia$i";$conv="con$i";$nulv="nul$i"; 61 if (isset($_GET[$gruv])) $id_gruppo[$i]=intval($_GET[$gruv]); else $id_gruppo[$i]='0'; 62 if (isset($_GET[$siv])) $si[$i]=intval($_GET[$siv]); else $si[$i]='0'; 63 if (isset($_GET[$nov])) $no[$i]=intval($_GET[$nov]); else $no[$i]='0'; 64 if (isset($_GET[$valv])) $val[$i]=intval($_GET[$valv]); else $val[$i]='0'; 65 if (isset($_GET[$biav])) $bia[$i]=intval($_GET[$biav]); else $bia[$i]='0'; 66 if (isset($_GET[$conv])) $con[$i]=intval($_GET[$conv]); else $con[$i]='0'; 67 if (isset($_GET[$nulv])) $nul[$i]=intval($_GET[$nulv]); else $nul[$i]='0'; 70 68 71 $sql="select num_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 72 $result = $dbi->prepare("$sql"); 73 $result->execute(); 74 if($result->rowCount()) { 75 while(list($i)=$result->fetch(PDO::FETCH_NUM)){ 69 $sql="select num_gruppo from ".$prefix."_ele_voti_ref where id_gruppo='$idgruppo' and id_sez=$id_sez"; 70 $result = $dbi->prepare("$sql"); 71 $result->execute(); 72 if($result->rowCount()) { 76 73 $sql="update ".$prefix."_ele_voti_ref set si='".$si[$i]."',no='".$no[$i]."',validi='".$val[$i]."',bianchi='".$bia[$i]."',contestati='".$con[$i]."',nulli='".$nul[$i]."' where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='".$id_gruppo[$i]."'"; 77 74 $res = $dbi->prepare("$sql"); 78 75 $res->execute(); 79 } 80 }else{ 81 $sql="select num_gruppo,id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 82 $result = $dbi->prepare("$sql"); 83 $result->execute(); 84 while(list($i,$id_gruppo)=$result->fetch(PDO::FETCH_NUM)){ 85 $sql="insert into ".$prefix."_ele_voti_ref values('$id_cons','$id_gruppo','$id_sez','$i','".$si[$i]."','".$no[$i]."','".$val[$i]."','".$bia[$i]."','".$con[$i]."','".$nul[$i]."')"; 76 }else{ 77 $sql="insert into ".$prefix."_ele_voti_ref values('$id_cons','$idgruppo','$id_sez','$i','".$si[$i]."','".$no[$i]."','".$val[$i]."','".$nul[$i]."','".$bia[$i]."','".$con[$i]."')"; 86 78 $res = $dbi->prepare("$sql"); 87 79 $res->execute(); 80 88 81 } 89 90 82 } 91 83 }
Note:
See TracChangeset
for help on using the changeset viewer.