source: trunk/admin/modules/Elezioni/ele_affluenze.php@ 430

Last change on this file since 430 was 344, checked in by roby, 4 years ago

Segue modifiche per la compatibilità php7.x

File size: 7.5 KB
Line 
1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Roberto Gigli & Luciano Apolito */
5/* http://www.eleonline.it */
6/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
7/************************************************************************/
8/* Modulo Affluenze */
9/* Amministrazione */
10/************************************************************************/
11
12
13if (!defined('ADMIN_FILE')) {
14 die ("You can't access this file directly...");
15}
16
17global $dbi;
18$aid=$_SESSION['aid'];
19#$dbi=$_SESSION['dbi'];
20$prefix=$_SESSION['prefix'];
21$language=$_SESSION['lang'];
22$id_cons_gen=$_GET['id_cons_gen'];
23$perms=ChiSei(0);
24if ($perms<256 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
25
26#include_once("modules/Elezioni/query.sql");
27include("modules/Elezioni/funzionidata.php");
28include("modules/Elezioni/ele.php");
29$row=descr_cons();$tipo_cons=$row[0];$genere=$row[1];$descr_cons=$row[2];
30
31if (isset($_GET['min'])) $min=intval($_GET['min']); else $min=0;
32if (isset($_GET['do'])) $do=addslashes($param['do']); else $do='';
33if (isset($_GET['ov'])) $ov=intval($_GET['ov']); else $ov='';
34if (isset($_GET['mv'])) $mv=intval($_GET['mv']); else $mv='';
35if (isset($_GET['gv'])) $gv=intval($_GET['gv']); else $gv='';
36if (isset($_GET['msv'])) $msv=intval($_GET['msv']); else $msv='';
37if (isset($_GET['av'])) $av=intval($_GET['av']); else $av='';
38if (isset($_GET['tipo'])) $tipo=addslashes($param['tipo']); else $tipo='';
39if (isset($_GET['ok'])) $ok=addslashes($param['ok']); else $ok='';
40if (isset($_GET['modello'])) $modello=addslashes($param['modello']); else $modello='';
41if (isset($_GET['help'])) $help=intval($_GET['help']);
42
43$offset=15;
44$hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
45
46
47
48
49 /******************************************************/
50 /*Funzione di visualizzazione globale */
51 /*****************************************************/
52 //crea la pagina delle affluenze
53 function all() {
54 global $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min,$id_cons_gen,$language,$help;
55
56 if (isset($help)) include("language/$language/ele_affluenze.html");
57
58 echo "<hr><br><br> <table border=\"0\" width=\"60%\" align=\"center\">"
59 ."<tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._ORA."</b></td>"
60 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DATA."</b></td>";
61# echo "<td bgcolor=\"$bgcolor1\">&nbsp;</td>";
62 echo "<td bgcolor=\"$bgcolor1\">&nbsp;</td></tr>";
63 $row=getaffluenze();
64 $max = count($row);
65 echo "<form name=\"rilaff\" action=\"admin.php\">"
66 ."<input type=\"hidden\" name=\"op\" value=\"rec_add_aff\">"
67 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
68 ."<input type=\"hidden\" name=\"do\" value=1>";
69 echo "<tr align=\"center\"><td>";
70 echo "<select name= \"ov\" ><option value=\"11\" selected>11</option>"; ore();
71 echo "<select name= \"mv\" ><option value=\"00\" selected>00</option>"; minuti();
72 echo "</td><td>";
73 $aff = daticonsultazione();
74 $data=$aff['data_inizio'];$fine=$aff['data_fine'];
75 list ($anno,$mese,$giorno)=explode('-',$data);
76 list ($annof,$mesef,$giornof)=explode('-',$fine);
77 echo "<select name= \"gv\" ><option value=\"$giorno\" selected>$giorno</option>"; giorno($giorno,$giornof);
78 echo "<select name= \"msv\" ><option value=\"$mese\" selected>$mese</option>"; mese();
79 echo "<select name= \"av\" ><option value=\"$anno\" selected>$anno</option>"; anno() ;
80 echo "</td>";
81
82 echo "<td><input type=\"hidden\" name=\"tipo\" value=\"add\">"
83 ."<input type=\"submit\" name=\"update\" value=\""._ADD."\"></td></tr>";
84
85 echo "</form><tr><td bgcolor=\"$bgcolor1\" colspan=\"3\">&nbsp;</td></tr>";
86 if ($max != "0") {
87 $i=1;
88 foreach($row as $aff)
89 {
90 $id_cons2=$aff[0];
91 $orario=$aff[1];
92 $data=$aff[2];
93 // esplode la data
94 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
95 list($av1,$msv1,$gv1) = explode("-",$data);
96 list($ov1,$mv1,$sv1) = explode(":",$orario);
97 $i++;
98
99 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
100 echo "<td><b>$ov1,$mv1</b></td>";
101 echo "<td><b>$gv1-$msv1-$av1</b></td>";
102 echo "<td><form name=\"canc$i\" action=\"admin.php\">"
103 ."<input type=\"hidden\" name=\"op\" value=\"rec_add_aff\">";
104 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
105 ."<input type=\"hidden\" name=\"do\" value=2>";
106 echo "<input type=\"hidden\" name=\"ov\" value=\"$ov1\">"
107 ."<input type=\"hidden\" name=\"mv\" value=\"$mv1\">"
108 ."<input type=\"hidden\" name=\"gv\" value=\"$gv1\">"
109 ."<input type=\"hidden\" name=\"msv\" value=\"$msv1\">"
110 ."<input type=\"hidden\" name=\"av\" value=\"$av1\">"
111 ."<input type=\"hidden\" name=\"tipo\" value=\"delete\">"
112 ."<input type=\"hidden\" name=\"ok\" value=0>"
113 ."<input type=\"submit\" name=\"erase$i\" value=\""._DELETE."\"></form></td>"
114 ."</tr>";
115 }
116 }
117 echo "</table>";
118 }
119
120 // memorizza le affluenze
121 function rec_add_aff($do,$ov,$mv,$gv,$msv,$av,$tipo,$ok, $modello) {
122 global $prefix, $dbi,$id_cons_gen;
123 $perms=ChiSei(0);
124 if ($perms<256) die("Non hai i permessi per eseguire questa operazione!");
125 $data="$av-$msv-$gv";
126 $orario="$ov:$mv:00";
127 $row = daticonsultazione();
128 $dadata=$row['data_inizio']; $adata=$row['data_fine'];
129 $dadata=strtotime($dadata);
130 $adata=strtotime($adata);
131 $cdata=strtotime($data);
132 // verifica se data e ora esiste e fa l'upgrade
133 $sql = "select * from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'";
134 $sth = $dbi->prepare("$sql");
135 $sth->execute();
136 $tipo= $sth->rowCount();
137 if(($tipo==0) and ($dadata <= $cdata) and ($adata >= $cdata)){
138 if(checkdate(intval($msv),intval($gv),intval($av))){
139 $sql="insert into ".$prefix."_ele_rilaff values ('$id_cons_gen','$orario','$data')";
140 $sth = $dbi->prepare("$sql");
141 $sth->execute();
142 }
143 Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen");
144 } elseif ($do==2) {
145 if ($ok !="1") {
146 ele();
147 OpenTable();
148 echo "<center><br><br>"._DOMCANCELLA." ?<br>";
149 echo "[ <a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">"._NO."</a> ] - [<a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen&amp;do=$do&amp;ops=1&amp;ov=$ov&amp;mv=$mv&amp;gv=$gv&amp;msv=$msv&amp;av=$av&amp;tipo=delete&amp;ok=1\">"._YES."</a> ]";
150 CloseTable();
151 include("footer.php");
152 die();
153 }else{
154 $sql = "select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'";
155 $sth = $dbi->prepare("$sql");
156 $sth->execute();
157 $row2 = $sth->fetchAll();
158 foreach($row2 as $id_cons2) {
159 $sql = "delete from ".$prefix."_ele_voti_parziale where id_cons='$id_cons2' and data='$data' and orario='$orario'";
160 $sth = $dbi->prepare("$sql");
161 $sth->execute();
162 }
163 $sql = "delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'";
164 $sth = $dbi->prepare("$sql");
165 $sth->execute();
166 Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen&contr=$data");
167 }
168 }else{
169 Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen&contr=$data");
170 }
171 }
172
173
174
175 if($do) rec_add_aff($do,$ov,$mv,$gv,$msv,$av,$tipo,$ok, $modello);
176 ele();
177 OpenTable();
178 all();
179 CloseTable();
180 include("footer.php");
181
182
183
184
185?>
186
Note: See TracBrowser for help on using the repository browser.