false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); $sql = "use $dbname"; $dbi->exec($sql); } catch(PDOException $e) { echo $sql . "
" . $e->getMessage(); } if (isset($_GET['genere'])) $genere=intval($_GET['genere']); else $genere='0'; if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen='0'; if (isset($_GET['id_cons'])) $id_cons=intval($_GET['id_cons']); else $id_cons='0'; if (isset($_GET['op'])) $op=intval($_GET['op']); else $op='0'; if (isset($_GET['id_circ'])) $id_circ=intval($_GET['id_circ']); else $id_circ='0'; if (isset($_GET['id_sez'])) $id_sez=intval($_GET['id_sez']); else $id_sez='0'; if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede='0'; if (isset($_GET['do'])) $do=intval($_GET['do']); else $do='0'; if (isset($_GET['validi'])) $validi=intval($_GET['validi']); else $validi='0'; if (isset($_GET['nulli'])) $nulli=intval($_GET['nulli']); else $nulli='0'; if (isset($_GET['bianchi'])) $bianchi=intval($_GET['bianchi']); else $bianchi='0'; if (isset($_GET['contestati'])) $contestati=intval($_GET['contestati']); else $contestati='0'; if (isset($_GET['votinulli'])) $votinulli=intval($_GET['votinulli']); else $votinulli='0'; if (isset($_GET['id_comune'])) $id_comune=intval($_GET['id_comune']); else $id_comune='0'; if (isset($_GET['ops'])) $ops=intval($_GET['ops']); else $ops='0'; if (isset($_GET['sololista'])) $sololista=intval($_GET['sololista']); else $sololista='0'; if (isset($_GET['delete'])) $delete=intval($_GET['delete']); else $delete=''; if (isset($_GET['circo'])) get_magic_quotes_gpc() ? $circo=$_GET['circo']:$circo=addslashes($_GET['circo']); else $circo=''; global $prefix,$id_parz,$fileout; $sql="select num_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo "; $result = $dbi->prepare("$sql"); $result->execute(); while(list($i)=$result->fetch(PDO::FETCH_BOTH)) { $vot="voti$i";$solo="solog$i";$grupp="num_gruppo$i"; if (isset($_GET[$grupp])) $num_gruppo[$i]=intval($_GET[$grupp]); else $num_gruppo[$i]='0'; if (isset($_GET[$vot])) $voti[$i]=intval($_GET[$vot]); else $voti[$i]='0'; if (isset($_GET[$solo])) $solog[$i]=intval($_GET[$solo]); else $solog[$i]='0'; } if (!isset($fileout)) $fileout=''; #if(($voti_u+$voti_d) and !$voti_t) $voti_t=$voti_u+$voti_d; if ($fileout) while (!$fp = fopen($fileout,"a")); ################## if($do==1) { $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="update ".$prefix."_ele_sezioni set validi_lista='',contestati_lista='',voti_nulli_lista='',solo_gruppo='',solo_lista='' where id_cons='$id_cons' and id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); }else{ $sql="SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' "; $res = $dbi->prepare("$sql"); $res->execute(); list($disgiunto)=$res->fetch(PDO::FETCH_NUM); if($disgiunto){ } $sql="update ".$prefix."_ele_sezioni set solo_lista='$sololista' where id_cons='$id_cons' and id_sez='$id_sez'"; $result = $dbi->prepare("$sql"); $result->execute(); $sql="select num_gruppo from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'"; $result = $dbi->prepare("$sql"); $result->execute(); if($result->rowCount()) { while(list($i)=$result->fetch(PDO::FETCH_NUM)){ $sql="update ".$prefix."_ele_voti_gruppo set voti='".$voti[$i]."',solo_gruppo='".$solog[$i]."' where id_cons='$id_cons' and id_sez='$id_sez' and num_gruppo='".$num_gruppo[$i]."'"; $res = $dbi->prepare("$sql"); $res->execute(); } }else{ $sql="select num_gruppo,id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'"; $result = $dbi->prepare("$sql"); $result->execute(); while(list($i,$id_gruppo)=$result->fetch(PDO::FETCH_NUM)){ $sql="insert into ".$prefix."_ele_voti_gruppo values('$id_cons','$id_gruppo','$id_sez','$i','".$voti[$i]."','".$solog[$i]."')"; $res = $dbi->prepare("$sql"); $res->execute(); } } } include("ele_controlli.php"); controllo_votig($id_cons,$id_sez,$genere); include("ele_colora_sez.php"); if ($fileout) fclose($fp); $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16); 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"); ################################# ?>