[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 |
|
---|
| 12 | if (!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);
|
---|
| 21 | if ($perms<128 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
| 22 | include("modules/Elezioni/funzionidata.php");
|
---|
| 23 | include("modules/Elezioni/ele.php");
|
---|
| 24 |
|
---|
| 25 | // Offset - visualizza il numero di elementi per pagina
|
---|
| 26 |
|
---|
| 27 | $offset=15;
|
---|
| 28 | if (isset($_GET['desc'])) get_magic_quotes_gpc() ? $desc=$param['desc']:$desc=addslashes($param['desc']);else $desc='';
|
---|
| 29 | if (isset($_GET['id_collegio'])) $id_collegio=intval($_GET['id_collegio']);else $id_collegio='';
|
---|
| 30 | if (isset($_GET['ok'])) $ok=intval($_GET['ok']); else $ok='';
|
---|
| 31 | if (isset($_GET['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']);else $do='';
|
---|
| 32 | if (isset($_GET['op'])) get_magic_quotes_gpc() ? $op=$param['op']:$op=addslashes($param['op']);else $op='';
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | /******************************************************/
|
---|
| 36 | /*Funzione di visualizzazione globale */
|
---|
| 37 | /*****************************************************/
|
---|
| 38 | //crea la pagina delle affluenze
|
---|
| 39 | function all() {
|
---|
| 40 | global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons,$desc,$id_cons_gen,$id_collegio;
|
---|
| 41 |
|
---|
| 42 | OpenTable();
|
---|
| 43 | $resmod = mysql_query("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", $dbi);
|
---|
| 44 | echo "<table><tr ALIGN=\"CENTER\">";
|
---|
| 45 | echo "<td bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";
|
---|
| 46 | echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";
|
---|
| 47 | echo "</tr>";
|
---|
| 48 | echo "<form name=\"modello\" action=\"admin.php\">"
|
---|
| 49 | ."<input type=\"hidden\" name=\"op\" value=\"inscollegi\">";
|
---|
| 50 | echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio\">";
|
---|
| 51 | echo "<tr align=\"center\">";
|
---|
| 52 | $ressede = mysql_query("SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi);
|
---|
| 53 | list($descr_cons)=mysql_fetch_row($ressede);
|
---|
| 54 | echo "<td>$descr_cons</td>";
|
---|
| 55 | echo "<td align=\"center\" width=\"32\"><input name=\"desc\" value=\"$desc\"></td>";
|
---|
| 56 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
|
---|
| 57 | echo "<input type=\"hidden\" name=\"ok\" value=0>";
|
---|
| 58 | if ($desc) {
|
---|
| 59 | echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
|
---|
| 60 | echo "<td><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td></tr></form>";
|
---|
| 61 | }else{
|
---|
| 62 | echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
|
---|
| 63 | echo "<td><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td></tr></form>";
|
---|
| 64 | }
|
---|
| 65 | $i=0;
|
---|
| 66 | while (list($id_collegio2,$desc,$descr_cons) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
|
---|
| 67 | $i++;
|
---|
| 68 | $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
|
---|
| 69 | echo "<form name=\"modello$i\" action=\"admin.php\">"
|
---|
| 70 | ."<input type=\"hidden\" name=\"op\" value=\"inscollegi\">";
|
---|
| 71 | echo "<input type=\"hidden\" name=\"do\" value=\"delete\">";
|
---|
| 72 | echo "<input type=\"hidden\" name=\"desc\" value=\"$desc\">";
|
---|
| 73 | echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio2\">";
|
---|
| 74 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
|
---|
| 75 | echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
|
---|
| 76 | echo "<td></td>";
|
---|
| 77 | echo "<td align=\"center\" width=\"32\"><b>$desc</b></td>";
|
---|
| 78 | echo "<input type=\"hidden\" name=\"ok\" value=0>";
|
---|
| 79 | echo "</td><td align=\"center\" nowrap>[<a
|
---|
| 80 | href=\"admin.php?op=inscollegi&desc=$desc&id_cons_gen=$id_cons_gen&id_collegio=$id_collegio2\"><img src=\"modules/Elezioni/images/edit.gif\"
|
---|
| 81 | border=\"0\" align=\"center\"> "._EDIT."</a>]";
|
---|
| 82 | echo "<td><input type=\"submit\" name=\"erase$i\" value=\""._DELETE."\">"
|
---|
| 83 | ."</td></tr></form>";
|
---|
| 84 | }
|
---|
| 85 | echo "</table>";
|
---|
| 86 | CloseTable();
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | function collegi($ok, $do,$desc,$id_collegio) {
|
---|
| 90 | global $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons_gen,$genere;
|
---|
| 91 | if ($do !="") {
|
---|
| 92 | if ($do == "delete") {
|
---|
| 93 | if ($ok !="1") {
|
---|
| 94 | ele();
|
---|
| 95 | echo "<center><br><br>"._DOMCANCELLA." "._COLLEGIO." $desc ?<br>";
|
---|
| 96 | echo "[ <a href=\"admin.php?op=inscollegi&id_cons_gen=$id_cons_gen&id_collegio=$id_collegio&desc=$desc\">"._NO."</a> ] - [<a href=\"admin.php?op=inscollegi&do=delete&id_cons_gen=$id_cons_gen&desc=$desc&id_collegio=$id_collegio&ok=1\">"._YES."</a> ]";
|
---|
| 97 | die();
|
---|
| 98 | }else{
|
---|
| 99 | $result = mysql_query("delete from ".$prefix."_ele_collegi where id_collegio='$id_collegio'", $dbi);
|
---|
| 100 | if (!$result) return;
|
---|
| 101 | Header("Location: admin.php?op=inscollegi&id_cons_gen=$id_cons_gen");
|
---|
| 102 | }
|
---|
| 103 | }
|
---|
| 104 | if ($do == "add") {
|
---|
| 105 | $result = mysql_query("insert into ".$prefix."_ele_collegi(id_cons_gen,descrizione) values ('$id_cons_gen','$desc')", $dbi) || die("Impossibile inserire il collegio! ".mysql_error());
|
---|
| 106 | }
|
---|
| 107 | if ($do == "update") {
|
---|
| 108 | $result = mysql_query("update ".$prefix."_ele_collegi set descrizione='$desc' , id_cons_gen='$id_cons_gen' where id_collegio='$id_collegio'", $dbi);
|
---|
| 109 | if (!$result) return;
|
---|
| 110 | # echo "update ".$prefix."_ele_collegi set descrizione='$desc' , id_cons_gen='$id_cons_gen' where id_collegio='$id_collegio'";
|
---|
| 111 | Header("Location: admin.php?op=inscollegi&id_cons_gen=$id_cons_gen&id_collegio=$id_collegio");
|
---|
| 112 | }
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | //****************************
|
---|
| 117 | switch ($op){
|
---|
| 118 | case "inscollegi":
|
---|
| 119 | if ($desc){
|
---|
| 120 | collegi($ok, $do,$desc,$id_collegio);
|
---|
| 121 | }else collegi('','','','');
|
---|
| 122 | break;
|
---|
| 123 | }
|
---|
| 124 | ele();
|
---|
| 125 | all();
|
---|
| 126 | include("footer.php");
|
---|
| 127 |
|
---|
| 128 | ?>
|
---|
| 129 |
|
---|