[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 |
|
---|
[344] | 26 | if (isset($_GET['genere'])) $genere=addslashes($_GET['genere']); else $genere='';
|
---|
| 27 | if (isset($_GET['id_cons_gen'])) $id_cons_gen=addslashes($_GET['id_cons_gen']); else $id_cons_gen='';
|
---|
| 28 | if (isset($_GET['id_cons'])) $id_cons=addslashes($_GET['id_cons']); else $id_cons='';
|
---|
| 29 | if (isset($_GET['op'])) $op=addslashes($_GET['op']); else $op='';
|
---|
| 30 | if (isset($_GET['id_circ'])) $id_circ=addslashes($_GET['id_circ']); else $id_circ='';
|
---|
| 31 | if (isset($_GET['id_sez'])) $id_sez=addslashes($_GET['id_sez']); else $id_sez='';
|
---|
| 32 | if (isset($_GET['id_sede'])) $id_sede=addslashes($_GET['id_sede']); else $id_sede='';
|
---|
| 33 | if (isset($_GET['validi'])) $validi=addslashes($_GET['validi']); else $validi='';
|
---|
| 34 | if (isset($_GET['nulli'])) $nulli=intval($_GET['nulli']); else $nulli='';
|
---|
| 35 | if (isset($_GET['bianchi'])) $bianchi=addslashes($_GET['bianchi']); else $bianchi='';
|
---|
| 36 | if (isset($_GET['contestati'])) $contestati=addslashes($_GET['contestati']); else $contestati='';
|
---|
| 37 | if (isset($_GET['votinulli'])) $votinulli=addslashes($_GET['votinulli']); else $votinulli='01-01-1900';
|
---|
| 38 | if (isset($_GET['id_comune'])) $id_comune=addslashes($_GET['id_comune']); else $id_comune='';
|
---|
| 39 | if (isset($_GET['ops'])) $ops=addslashes($_GET['ops']); else $ops='';
|
---|
| 40 | if (isset($_GET['delete'])) $delete=addslashes($_GET['delete']); else $delete='';
|
---|
[261] | 41 |
|
---|
| 42 | global $prefix,$id_parz,$genere,$fileout,$id_cons;
|
---|
| 43 | if (!isset($fileout)) $fileout='';
|
---|
| 44 | #if(($voti_u+$voti_d) and !$voti_t) $voti_t=$voti_u+$voti_d;
|
---|
| 45 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 46 |
|
---|
| 47 | $salvato=0;
|
---|
| 48 |
|
---|
| 49 | ##################
|
---|
| 50 | $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
| 51 | $result = $dbi->prepare("$sql");
|
---|
| 52 | $result->execute();
|
---|
| 53 | list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);
|
---|
| 54 | $sql="select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
| 55 | $result = $dbi->prepare("$sql");
|
---|
| 56 | $result->execute();
|
---|
| 57 | $ar=$result->fetch(PDO::FETCH_BOTH);
|
---|
| 58 | $validilista=$validi-$ar['solo_gruppo'];
|
---|
| 59 | $log_data= date("Y/m/d");
|
---|
| 60 | $log_ora=getdate(time());
|
---|
| 61 | $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']);
|
---|
| 62 |
|
---|
| 63 | #if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and ($votog or $genere==4)){
|
---|
| 64 | $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')";
|
---|
| 65 | $res = $dbi->prepare("$sql");
|
---|
| 66 | $res->execute();
|
---|
| 67 | $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' ";
|
---|
| 68 | $res = $dbi->prepare("$sql");
|
---|
| 69 | $res->execute();
|
---|
| 70 | if ($fileout) fwrite($fp,"$sql;\n");
|
---|
| 71 | /*}else{
|
---|
| 72 | $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')";
|
---|
| 73 | $res = $dbi->prepare("$sql");
|
---|
| 74 | $res->execute();
|
---|
| 75 | $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' ";
|
---|
| 76 | $res = $dbi->prepare("$sql");
|
---|
| 77 | $res->execute();
|
---|
| 78 | if ($fileout) fwrite($fp,"$sql;\n"); */
|
---|
| 79 | #}
|
---|
[262] | 80 | include("ele_controlli.php");
|
---|
[261] | 81 | controllo_voti($id_cons,$id_sez);
|
---|
[262] | 82 | include("ele_colora_sez.php");
|
---|
[261] | 83 |
|
---|
| 84 | if ($fileout) fclose($fp);
|
---|
| 85 | $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16);
|
---|
| 86 | 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");
|
---|
| 87 | #################################
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 |
|
---|
[262] | 93 |
|
---|
[261] | 94 | ?>
|
---|