source: trunk/admin/modules/Elezioni/ele_collegi.php@ 424

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

Segue modifiche per la compatibilità php7.x

File size: 6.1 KB
RevLine 
[2]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 definizione collegi o zone */
9/* Amministrazione */
10/************************************************************************/
11
12if (!defined('ADMIN_FILE')) {
13 die ("You can't access this file directly...");
14}
15
16$aid=$_SESSION['aid'];
17$dbi=$_SESSION['dbi'];
18$prefix=$_SESSION['prefix'];
19$id_cons_gen=$_GET['id_cons_gen'];
20$perms=ChiSei(0);
21if ($perms<128 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
22include("modules/Elezioni/funzionidata.php");
23include("modules/Elezioni/ele.php");
24
25// Offset - visualizza il numero di elementi per pagina
26
27$offset=15;
[344]28if (isset($_GET['desc'])) $desc=addslashes($param['desc']);else $desc='';
[2]29if (isset($_GET['id_collegio'])) $id_collegio=intval($_GET['id_collegio']);else $id_collegio='';
30if (isset($_GET['ok'])) $ok=intval($_GET['ok']); else $ok='';
[344]31if (isset($_GET['do'])) $do=addslashes($param['do']);else $do='';
32if (isset($_GET['op'])) $op=addslashes($param['op']);else $op='';
[2]33
34
35 /******************************************************/
36 /*Funzione di visualizzazione globale */
37 /*****************************************************/
38 //crea la pagina delle affluenze
39function all() {
40 global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons,$desc,$id_cons_gen,$id_collegio;
41
42 OpenTable();
[257]43 $sql = "SELECT t1.id_collegio, t1.descrizione, t2.descrizione FROM ".$prefix."_ele_collegi as t1, ".$prefix."_ele_consultazione as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen=$id_cons_gen order by t1.descrizione asc";
44 $resmod = $dbi->prepare("$sql");
45 $resmod->execute();
[2]46 echo "<table><tr ALIGN=\"CENTER\">";
47 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";
48 echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";
49 echo "</tr>";
50 echo "<form name=\"modello\" action=\"admin.php\">"
51 ."<input type=\"hidden\" name=\"op\" value=\"inscollegi\">";
52 echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio\">";
53 echo "<tr align=\"center\">";
[257]54 $sql = "SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'";
55 $ressede = $dbi->prepare("$sql");
56 $ressede->execute();
57 list($descr_cons)=$ressede->fetch(PDO::FETCH_NUM);
[2]58 echo "<td>$descr_cons</td>";
59 echo "<td align=\"center\" width=\"32\"><input name=\"desc\" value=\"$desc\"></td>";
60 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
61 echo "<input type=\"hidden\" name=\"ok\" value=0>";
62 if ($desc) {
63 echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
64 echo "<td><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td></tr></form>";
65 }else{
66 echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
67 echo "<td><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td></tr></form>";
68 }
69 $i=0;
[257]70 while (list($id_collegio2,$desc,$descr_cons) = $resmod->fetch(PDO::FETCH_NUM)){ //elenco dei modelli inseriti
[2]71 $i++;
72 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
73 echo "<form name=\"modello$i\" action=\"admin.php\">"
74 ."<input type=\"hidden\" name=\"op\" value=\"inscollegi\">";
75 echo "<input type=\"hidden\" name=\"do\" value=\"delete\">";
76 echo "<input type=\"hidden\" name=\"desc\" value=\"$desc\">";
77 echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio2\">";
78 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
79 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
80 echo "<td></td>";
81 echo "<td align=\"center\" width=\"32\"><b>$desc</b></td>";
82 echo "<input type=\"hidden\" name=\"ok\" value=0>";
83 echo "</td><td align=\"center\" nowrap>[<a
84 href=\"admin.php?op=inscollegi&amp;desc=$desc&amp;id_cons_gen=$id_cons_gen&amp;id_collegio=$id_collegio2\"><img src=\"modules/Elezioni/images/edit.gif\"
85 border=\"0\" align=\"center\"> "._EDIT."</a>]";
86 echo "<td><input type=\"submit\" name=\"erase$i\" value=\""._DELETE."\">"
87 ."</td></tr></form>";
88 }
89 echo "</table>";
90 CloseTable();
91 }
92
93function collegi($ok, $do,$desc,$id_collegio) {
94 global $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons_gen,$genere;
95 if ($do !="") {
96 if ($do == "delete") {
97 if ($ok !="1") {
98 ele();
99 echo "<center><br><br>"._DOMCANCELLA." "._COLLEGIO." $desc ?<br>";
100 echo "[ <a href=\"admin.php?op=inscollegi&amp;id_cons_gen=$id_cons_gen&amp;id_collegio=$id_collegio&amp;desc=$desc\">"._NO."</a> ] - [<a href=\"admin.php?op=inscollegi&amp;do=delete&amp;id_cons_gen=$id_cons_gen&amp;desc=$desc&amp;id_collegio=$id_collegio&amp;ok=1\">"._YES."</a> ]";
101 die();
102 }else{
[257]103 $sql = "delete from ".$prefix."_ele_collegi where id_collegio='$id_collegio'";
104 $result = $dbi->prepare("$sql");
105 $result->execute();
106 if (!$result->rowCount()) return;
[2]107 Header("Location: admin.php?op=inscollegi&id_cons_gen=$id_cons_gen");
108 }
109 }
110 if ($do == "add") {
[257]111 $sql = "insert into ".$prefix."_ele_collegi(id_cons_gen,descrizione) values ('$id_cons_gen','$desc')";
112 $result = $dbi->prepare("$sql");
113 $result->execute();
[2]114 }
115 if ($do == "update") {
[257]116 $sql= "update ".$prefix."_ele_collegi set descrizione='$desc' , id_cons_gen='$id_cons_gen' where id_collegio='$id_collegio'";
117 $result = $dbi->prepare("$sql");
118 $result->execute();
119 if (!$result->rowCount()) return;
120 Header("Location: admin.php?op=inscollegi&id_cons_gen=$id_cons_gen&id_collegio=$id_collegio");
[2]121 }
122 }
123}
124
125//****************************
126 switch ($op){
127 case "inscollegi":
128 if ($desc){
129 collegi($ok, $do,$desc,$id_collegio);
130 }else collegi('','','','');
131 break;
132 }
133 ele();
134 all();
135 include("footer.php");
136
137?>
138
Note: See TracBrowser for help on using the repository browser.