[261] | 1 | <?php
|
---|
| 2 | /************************************************************************/
|
---|
| 3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 4 | /************************************************************************/
|
---|
| 5 | /* Modulo salva affluenze */
|
---|
| 6 | /* Amministrazione */
|
---|
| 7 | /************************************************************************/
|
---|
| 8 | session_name('sesadmin');
|
---|
| 9 | // gestione sessione
|
---|
| 10 | $a = session_id();
|
---|
| 11 | if(empty($a)) session_start();
|
---|
| 12 | if(!$_SESSION['aid'])
|
---|
| 13 | die ("You can't access this file directly...");
|
---|
| 14 | $aid=$_SESSION['aid'];
|
---|
| 15 | include("../../config.php");
|
---|
| 16 | try{
|
---|
| 17 | $dbi = new PDO("mysql:host=$dbhost;charset=latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
|
---|
| 18 | $sql = "use $dbname";
|
---|
| 19 | $dbi->exec($sql);
|
---|
| 20 | }
|
---|
| 21 | catch(PDOException $e)
|
---|
| 22 | {
|
---|
| 23 | echo $sql . "<br>" . $e->getMessage();
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | if (isset($_GET['genere'])) $genere=intval($_GET['genere']); else $genere='0';
|
---|
| 27 | if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen='0';
|
---|
| 28 | if (isset($_GET['id_cons'])) $id_cons=intval($_GET['id_cons']); else $id_cons='0';
|
---|
| 29 | if (isset($_GET['op'])) $op=intval($_GET['op']); else $op='0';
|
---|
| 30 | if (isset($_GET['id_circ'])) $id_circ=intval($_GET['id_circ']); else $id_circ='0';
|
---|
| 31 | if (isset($_GET['id_sez'])) $id_sez=intval($_GET['id_sez']); else $id_sez='0';
|
---|
| 32 | if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede='0';
|
---|
| 33 | if (isset($_GET['do'])) $do=intval($_GET['do']); else $do='0';
|
---|
| 34 | if (isset($_GET['validi'])) $validi=intval($_GET['validi']); else $validi='0';
|
---|
| 35 | if (isset($_GET['nulli'])) $nulli=intval($_GET['nulli']); else $nulli='0';
|
---|
| 36 | if (isset($_GET['bianchi'])) $bianchi=intval($_GET['bianchi']); else $bianchi='0';
|
---|
| 37 | if (isset($_GET['contestati'])) $contestati=intval($_GET['contestati']); else $contestati='0';
|
---|
| 38 | if (isset($_GET['votinulli'])) $votinulli=intval($_GET['votinulli']); else $votinulli='0';
|
---|
| 39 | if (isset($_GET['id_comune'])) $id_comune=intval($_GET['id_comune']); else $id_comune='0';
|
---|
[326] | 40 | if (isset($_GET['ops'])) $ops=intval($_GET['ops']); else $ops='4';
|
---|
[261] | 41 | if (isset($_GET['delete'])) $delete=intval($_GET['delete']); else $delete='';
|
---|
[344] | 42 | if (isset($_GET['circo'])) $circo=addslashes($_GET['circo']); else $circo='';
|
---|
[261] | 43 |
|
---|
| 44 | global $prefix,$id_parz,$fileout;
|
---|
[327] | 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();
|
---|
[261] | 48 |
|
---|
[327] | 49 | if (!isset($fileout)) $fileout='';
|
---|
[261] | 50 |
|
---|
| 51 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 52 |
|
---|
| 53 | ##################
|
---|
| 54 | if($do==1) {
|
---|
[327] | 55 | $sql="delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez=$id_sez";
|
---|
[261] | 56 | $res = $dbi->prepare("$sql");
|
---|
| 57 | $res->execute();
|
---|
[328] | 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();
|
---|
[261] | 61 | }else{
|
---|
[327] | 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 (isset($_GET[$gruv])) $id_gruppo[$i]=intval($_GET[$gruv]); else $id_gruppo[$i]='0';
|
---|
| 65 | if (isset($_GET[$siv])) $si[$i]=intval($_GET[$siv]); else $si[$i]='0';
|
---|
| 66 | if (isset($_GET[$nov])) $no[$i]=intval($_GET[$nov]); else $no[$i]='0';
|
---|
| 67 | if (isset($_GET[$valv])) $val[$i]=intval($_GET[$valv]); else $val[$i]='0';
|
---|
| 68 | if (isset($_GET[$biav])) $bia[$i]=intval($_GET[$biav]); else $bia[$i]='0';
|
---|
| 69 | if (isset($_GET[$conv])) $con[$i]=intval($_GET[$conv]); else $con[$i]='0';
|
---|
| 70 | if (isset($_GET[$nulv])) $nul[$i]=intval($_GET[$nulv]); else $nul[$i]='0';
|
---|
[261] | 71 |
|
---|
[327] | 72 | $sql="select num_gruppo from ".$prefix."_ele_voti_ref where id_gruppo='$idgruppo' and id_sez=$id_sez";
|
---|
| 73 | $result = $dbi->prepare("$sql");
|
---|
| 74 | $result->execute();
|
---|
| 75 | if($result->rowCount()) {
|
---|
[261] | 76 | $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 | $res = $dbi->prepare("$sql");
|
---|
| 78 | $res->execute();
|
---|
[328] | 79 | }elseif($val[$i]!=''){
|
---|
[327] | 80 | $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]."')";
|
---|
[261] | 81 | $res = $dbi->prepare("$sql");
|
---|
| 82 | $res->execute();
|
---|
[327] | 83 |
|
---|
[261] | 84 | }
|
---|
| 85 | }
|
---|
[328] | 86 | include("ele_controlli.php");
|
---|
| 87 | controllo_votir($id_cons,$id_sez);
|
---|
| 88 | }
|
---|
[261] | 89 |
|
---|
| 90 |
|
---|
[328] | 91 |
|
---|
[262] | 92 | include("ele_colora_sez.php");
|
---|
[261] | 93 | if ($fileout) fclose($fp);
|
---|
| 94 | $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16);
|
---|
| 95 | 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");
|
---|
| 96 | #################################
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | ?>
|
---|