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=''; if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen=''; if (isset($_GET['id_cons'])) $id_cons=intval($_GET['id_cons']); else $id_cons=''; if (isset($_GET['op'])) $op=intval($_GET['op']); else $op=''; if (isset($_GET['id_circ'])) $id_circ=intval($_GET['id_circ']); else $id_circ=''; if (isset($_GET['id_sez'])) $id_sez=intval($_GET['id_sez']); else $id_sez=''; if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede=''; if (isset($_GET['validi'])) $validi=intval($_GET['validi']); else $validi=''; if (isset($_GET['nulli'])) $nulli=intval($_GET['nulli']); else $nulli=''; if (isset($_GET['bianchi'])) $bianchi=intval($_GET['bianchi']); else $bianchi=''; if (isset($_GET['contestati'])) $contestati=intval($_GET['contestati']); else $contestati=''; if (isset($_GET['votinulli'])) $votinulli=intval($_GET['votinulli']); else $votinulli='01-01-1900'; if (isset($_GET['id_comune'])) $id_comune=intval($_GET['id_comune']); else $id_comune=''; if (isset($_GET['ops'])) $ops=intval($_GET['ops']); else $ops=''; if (isset($_GET['delete'])) $delete=intval($_GET['delete']); else $delete=''; if (isset($_GET['scrutinata'])) {$scrutinata=$_GET['scrutinata']==false ? false : true;}else $scrutinata=false; #$_SESSION['scrutinata']=$scrutinata; #if(isset($_SESSION['scrutinata'])) $scrutinata=$_SESSION['scrutinata']; #else $scrutinata=false; global $prefix,$id_parz,$genere,$fileout,$id_cons; $sql="select solo_gruppo,disgiunto,chiusa from ".$prefix."_ele_cons_comune where id_cons='$id_cons' "; $result = $dbi->prepare("$sql"); $result->execute(); list($flagsg,$disgiunto,$chiusa)=$result->fetch(PDO::FETCH_NUM); if(!$chiusa){ 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")); $salvato=0; ################## $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' "; $result = $dbi->prepare("$sql"); $result->execute(); $ar=$result->fetch(PDO::FETCH_BOTH); $validilista=$validi-$ar['solo_gruppo']; $log_data= date("Y/m/d"); $log_ora=getdate(time()); $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']); #if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and ($votog or $genere==4)){ $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','$log_data','$orario','validi_lista:$ar[14] nulli:$ar[7] bianchi:$ar[8] ','validi_lista=$validilista, nulli=$nulli,bianchi=$bianchi','_ele_sezioni')"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', nulli='$nulli',bianchi='$bianchi', voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; $res = $dbi->prepare("$sql"); $res->execute(); if ($fileout) fwrite($fp,"$sql;\n"); ###### #include($sql."TEST: scru=$scrutinata"); if(isset($scrutinata)) { $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and num_gruppo=0"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and num_lista=0"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez' and num_cand=0"; $res = $dbi->prepare("$sql"); $res->execute(); if($scrutinata==true) { # provare insert dei soli id_cons e id_sez $sql="insert into ".$prefix."_ele_voti_gruppo (id_cons,id_sez,num_gruppo) values('$id_cons','$id_sez',0)"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="insert into ".$prefix."_ele_voti_lista (id_cons,id_sez) values('$id_cons','$id_sez')"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="insert into ".$prefix."_ele_voti_candidati (id_cons,id_sez,num_cand) values('$id_cons','$id_sez',0)"; $res = $dbi->prepare("$sql"); $res->execute(); # } } /*}else{ $sql="insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$aid','','','validi:$ar[6] nulli:$ar[7] bianchi:$ar[8] contestati:$ar[9] voti_nulli:$ar[13]','validi=$validi, nulli=$nulli,bianchi=$bianchi,contestati=$contestati, voti_nulli=$votinulli','_ele_sezioni')"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="update ".$prefix."_ele_sezioni set validi='$validi', nulli='$nulli',bianchi='$bianchi',contestati='$contestati',voti_nulli='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' "; $res = $dbi->prepare("$sql"); $res->execute(); if ($fileout) fwrite($fp,"$sql;\n"); */ #} include("ele_controlli.php"); controllo_voti($id_cons,$id_sez); 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"); ################################# ?>