Changeset 407 for trunk/admin/modules/Elezioni/salva_ref.php
- Timestamp:
- Mar 5, 2024, 10:09:23 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/salva_ref.php
r366 r407 43 43 44 44 global $prefix,$id_parz,$fileout; 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(); 45 $sql="SELECT chiusa FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' "; 46 $res = $dbi->prepare("$sql"); 47 $res->execute(); 48 list($chiusa)=$res->fetch(PDO::FETCH_NUM); 49 if(!$chiusa){ 50 $sql="select num_gruppo,id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' ORDER BY num_gruppo "; 51 $resultg = $dbi->prepare("$sql"); 52 $resultg->execute(); 48 53 49 if (!isset($fileout)) $fileout='';54 if (!isset($fileout)) $fileout=''; 50 55 51 if ($fileout) while (!$fp = fopen($fileout,"a"));56 if ($fileout) while (!$fp = fopen($fileout,"a")); 52 57 53 ##################54 if($do==1) {55 $sql="delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez=$id_sez";56 $res = $dbi->prepare("$sql");57 $res->execute();58 $sql="delete from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez=$id_sez";59 $res = $dbi->prepare("$sql");60 $res->execute();61 }else{62 while(list($i,$idgruppo)=$resultg->fetch(PDO::FETCH_BOTH)) {63 $gruv="id_gruppo$i";$siv="si$i";$nov="no$i";$valv="val$i";$biav="bia$i";$conv="con$i";$nulv="nul$i";64 if($_GET[$siv]=='' and $_GET[$nov]=='' and $_GET[$biav]=='' and $_GET[$conv]=='' and $_GET[$nulv]=='') continue;65 if (isset($_GET[$gruv])) $id_gruppo[$i]=intval($_GET[$gruv]); else $id_gruppo[$i]='0';66 if (isset($_GET[$siv])) $si[$i]=intval($_GET[$siv]); else $si[$i]='0';67 if (isset($_GET[$nov])) $no[$i]=intval($_GET[$nov]); else $no[$i]='0';68 if (isset($_GET[$valv])) $val[$i]=intval($_GET[$valv]); else $val[$i]='0';69 if (isset($_GET[$biav])) $bia[$i]=intval($_GET[$biav]); else $bia[$i]='0';70 if (isset($_GET[$conv])) $con[$i]=intval($_GET[$conv]); else $con[$i]='0';71 if (isset($_GET[$nulv])) $nul[$i]=intval($_GET[$nulv]); else $nul[$i]='0';58 ################## 59 if($do==1) { 60 $sql="delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez=$id_sez"; 61 $res = $dbi->prepare("$sql"); 62 $res->execute(); 63 $sql="delete from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez=$id_sez"; 64 $res = $dbi->prepare("$sql"); 65 $res->execute(); 66 }else{ 67 while(list($i,$idgruppo)=$resultg->fetch(PDO::FETCH_BOTH)) { 68 $gruv="id_gruppo$i";$siv="si$i";$nov="no$i";$valv="val$i";$biav="bia$i";$conv="con$i";$nulv="nul$i"; 69 if($_GET[$siv]=='' and $_GET[$nov]=='' and $_GET[$biav]=='' and $_GET[$conv]=='' and $_GET[$nulv]=='') continue; 70 if (isset($_GET[$gruv])) $id_gruppo[$i]=intval($_GET[$gruv]); else $id_gruppo[$i]='0'; 71 if (isset($_GET[$siv])) $si[$i]=intval($_GET[$siv]); else $si[$i]='0'; 72 if (isset($_GET[$nov])) $no[$i]=intval($_GET[$nov]); else $no[$i]='0'; 73 if (isset($_GET[$valv])) $val[$i]=intval($_GET[$valv]); else $val[$i]='0'; 74 if (isset($_GET[$biav])) $bia[$i]=intval($_GET[$biav]); else $bia[$i]='0'; 75 if (isset($_GET[$conv])) $con[$i]=intval($_GET[$conv]); else $con[$i]='0'; 76 if (isset($_GET[$nulv])) $nul[$i]=intval($_GET[$nulv]); else $nul[$i]='0'; 72 77 73 $sql="select num_gruppo from ".$prefix."_ele_voti_ref where id_gruppo='$idgruppo' and id_sez=$id_sez"; 74 $result = $dbi->prepare("$sql"); 75 $result->execute(); 76 if($result->rowCount()) { 77 $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]."'"; 78 $res = $dbi->prepare("$sql"); 79 $res->execute(); 80 }elseif($val[$i]!=''){ 81 $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]."')"; 82 $res = $dbi->prepare("$sql"); 83 $res->execute(); 84 78 $sql="select num_gruppo from ".$prefix."_ele_voti_ref where id_gruppo='$idgruppo' and id_sez=$id_sez"; 79 $result = $dbi->prepare("$sql"); 80 $result->execute(); 81 if($result->rowCount()) { 82 $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]."'"; 83 $res = $dbi->prepare("$sql"); 84 $res->execute(); 85 }elseif($val[$i]!=''){ 86 $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]."')"; 87 $res = $dbi->prepare("$sql"); 88 $res->execute(); 89 90 } 85 91 } 92 include("ele_controlli.php"); 93 controllo_votir($id_cons,$id_sez); 86 94 } 87 include("ele_controlli.php"); 88 controllo_votir($id_cons,$id_sez); 89 } 90 91 92 93 include("ele_colora_sez.php"); 94 if ($fileout) fclose($fp); 95 include("ele_colora_sez.php"); 96 if ($fileout) fclose($fp); 97 } 95 98 $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16); 96 99 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&do=spoglio&ops=$ops"); 97 100 ################################# 98 101 99 100 101 102 103 104 105 102 ?>
Note:
See TracChangeset
for help on using the changeset viewer.