source: trunk/admin/modules/Elezioni/ele_tipi.php@ 53

Last change on this file since 53 was 2, checked in by root, 15 years ago

importo il progetto

File size: 5.6 KB
Line 
1<?php
2
3/************************************************************************/
4/* Eleonline - Raccolta e diffusione dei dati elettorali */
5/* by Roberto Gigli & Luciano Apolito */
6/* http://www.eleonline.it */
7/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
8/************************************************************************/
9/* Modulo cambio password amministrazione */
10/* Amministrazione */
11/************************************************************************/
12
13
14if (!defined('ADMIN_FILE')) {
15 die ("You can't access this file directly...");
16}
17$aid=$_SESSION['aid'];
18$dbi=$_SESSION['dbi'];
19$prefix=$_SESSION['prefix'];
20$currentlang=$_SESSION['lang'];
21$id_comune=$_SESSION['id_comune'];
22$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
23$id_cons_gen=intval($param['id_cons_gen']);
24$perms=ChiSei(0);
25
26if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do='';
27if (isset($param['descr_tipo'])) get_magic_quotes_gpc() ? $descr_tipo=$param['descr_tipo']:$descr_tipo=addslashes($param['descr_tipo']); else $descr_tipo='';
28if (isset($param['lang_tipo'])) get_magic_quotes_gpc() ? $lang_tipo=$param['lang_tipo']:$lang_tipo=addslashes($param['lang_tipo']); else $lang_tipo='';
29if (isset($param['op'])) get_magic_quotes_gpc() ? $op=$param['op']:$op=addslashes($param['op']); else $op='cambiopwd';
30if (isset($param['tipocons'])) $tipocons=intval($param['tipocons']); else $tipocons='';
31$lang_tipo=strtolower($lang_tipo);
32
33/*********************************************************/
34/* gestione tipologie Functions */
35/*********************************************************/
36
37include("modules/Elezioni/ele.php");
38
39
40function tipi() {
41 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $id_cons_gen, $op, $do, $descr_tipo, $tipocons, $lang_tipo, $language;
42 echo "<center><font class=\"title\"><b>"._GESTIPO."</b></font></center><br>";
43 echo "<br><br><table border=\"0\" width=\"100%\" ><tr>"
44 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NUM."</b></td>"
45 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DESCR."</b></td>"
46 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._LINGUA."</b></td><td>&nbsp;</td></tr>";
47//-----------------------visualizza riga superiore per inserimento -
48 echo "<form name=\"tipi2\" enctype=\"multipart/form-data\" action=\"admin.php\" method=\"post\">"
49 ."<input type=\"hidden\" name=\"op\" value=\"tipo\">";
50 $res=mysql_query("SELECT * FROM ".$prefix."_ele_tipo where lingua='$language' order by tipo_cons", $dbi);
51 $max = mysql_num_rows($res);
52 $nuovo_tipo=$max+1;
53 if ($do=='modify') {
54 $resl = mysql_query("SELECT * FROM ".$prefix."_ele_tipo where tipo_cons='$tipocons'", $dbi);
55 $tipo=mysql_fetch_array($resl);
56 $nuovo_tipo=$tipo['tipo_cons'];
57 echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
58 echo "<input type=\"hidden\" name=\"lang_tipo\" value=\"".$tipo['lingua']."\">";
59 echo "<input type=\"hidden\" name=\"tipocons\" value=\"$tipocons\">";
60 echo "<tr><td>".$tipo['tipo_cons']."</td>";
61 }else{
62 $tipo['tipo_cons']='';
63 if ($descr_tipo) $tipo['descrizione']="$descr_tipo";else $tipo['descrizione']='';
64 if ($lang_tipo) $tipo['lingua']="$lang_tipo";else $tipo['lingua']=$_SESSION['lang'];
65 echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
66 echo "<tr><td><input type=\"text\" name=\"tipocons\" value=\"$nuovo_tipo\" size=\"5\"></td>";
67 }
68 echo "<td><input type=\"text\" name=\"descr_tipo\" size=\"35\" value=\"".$tipo['descrizione']."\"></td>";
69 if ($do=='modify') {
70 echo "<td>".$tipo['lingua']."</td>";
71 echo "<td align=\"center\"><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td>";
72 }else{
73 echo "<td><input type=\"text\" name=\"lang_tipo\" size=\"35\" value=\"".$tipo['lingua']."\"></td>";
74 echo "<td align=\"center\"><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td>";
75 }
76 echo "</tr></form>";
77//-----------------------fine visualizza riga superiore per inserimento -
78
79
80 while(list($tipov,$descv,$langv)= mysql_fetch_row($res)){
81 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
82 echo "<form name=\"elenco\" action=\"admin.php\" method=\"post\" >";
83 echo "<tr bgcolor=\"$bgcolor1\"><td align=\"right\"><b>$tipov</b></td>"
84 ."<td align=\"left\"><b>$descv</b></td>"
85 ."<td align=\"left\"><b>$langv</b></td>";
86 echo "<td align=\"center\" nowrap>[<a
87 href=\"admin.php?op=tipo&amp;do=modify&amp;id_cons_gen=$id_cons_gen&amp;tipocons=$tipov\"><img src=\"modules/Elezioni/images/edit.gif\" border=\"0\" align=\"center\"> "._EDIT."</a>]</td>";
88 echo "</tr></form>";
89 }
90 echo "</table></center><br>";
91}
92
93function savetipo() {
94 global $prefix, $dbi,$id_cons_gen,$op,$do,$tipocons,$descr_tipo,$lang_tipo;
95 $aid=$_SESSION['aid'];
96 $perms=ChiSei($id_cons_gen);
97 if ($perms == 256) {
98 if ($descr_tipo){
99 if ($do == "add") {
100 $result = mysql_query("insert into ".$prefix."_ele_tipo (tipo_cons,descrizione,lingua) values ('$tipocons','$descr_tipo','$lang_tipo')", $dbi);
101 if (!$result) return;
102 }elseif ($do == "update") {
103 $result = mysql_query("update ".$prefix."_ele_tipo set descrizione='$descr_tipo' where tipo_cons='$tipocons' and lingua='$lang_tipo'", $dbi);
104 if (!$result) return;
105 }
106 }else if ($lang_tipo) $_SESSION['lang']=$lang_tipo;
107 Header("Location: admin.php?op=$op&id_cons_gen=$id_cons_gen");
108 }
109}
110
111
112
113
114if ($do and $do!='modify')
115 savetipo();
116ele();
117tipi();
118echo"</td></tr></table>";
119include("footer.php");
120
121?>
Note: See TracBrowser for help on using the repository browser.