Changeset 256 for trunk/admin/modules/Elezioni/ele_widget.php
- Timestamp:
- Jan 16, 2019, 7:06:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_widget.php
r53 r256 15 15 // Offset - visualizza il numero di elementi per pagina 16 16 $offset=5; 17 17 global $dbi; 18 18 $aid=$_SESSION['aid']; 19 $dbi=$_SESSION['dbi'];20 19 $prefix=$_SESSION['prefix']; 21 20 $currentlang=$_SESSION['lang']; … … 26 25 27 26 $id_comune=$_SESSION['id_comune']; 28 $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune' " , $dbi); 29 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 27 #$res = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune' " , $dbi); 30 28 31 29 include("modules/Elezioni/funzionidata.php"); 32 30 include("modules/Elezioni/ele.php"); 31 $row=cur_cons(); 32 $tipo_cons=$row[0];$id_cons=$row[1]; 33 33 34 34 if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; … … 64 64 $files=$tlist[$i]; 65 65 66 $sql = mysql_query("SELECT id FROM ".$prefix."_ele_widget where nome_file='$files'", $dbi); 67 list($idwid) = mysql_fetch_row($sql); 66 $sql = "SELECT id FROM ".$prefix."_ele_widget where nome_file='$files'"; 67 $sth = $dbi->prepare("$sql"); 68 $sth->execute(); 69 $row = $sth->fetch(PDO::FETCH_BOTH); 70 $idwid=$row[0]; 68 71 $id = intval($idwid); 69 72 70 71 73 if (empty($id)) { // inserisce widget db se non esiste 72 $result = mysql_query("insert into ".$prefix."_ele_widget (id,nome_file,titolo,pos_or,pos_ver, attivo) values ( NULL,'$files', '$files','1','','0')", $dbi); 73 } 74 $sql="insert into ".$prefix."_ele_widget (id,nome_file,titolo,pos_or,pos_ver, attivo) values ( NULL,'$files', '$files','1','','0')"; 75 $sth = $dbi->prepare("$sql"); 76 $sth->execute(); } 74 77 75 78 … … 84 87 85 88 # se non esiste cancella dal db 86 $sql2 = mysql_query("SELECT * FROM ".$prefix."_ele_widget", $dbi); 87 while ($row = mysql_fetch_array($sql2)) { 89 $sql="SELECT * FROM ".$prefix."_ele_widget"; 90 $sth = $dbi->prepare("$sql"); 91 $sth->execute(); 92 $row2 = $sth->fetchAll(); 93 foreach($row2 as $row){ 88 94 $esi=0; 89 95 for ($i=0; $i < sizeof($tlist); $i++) { … … 92 98 } 93 99 if($esi!=1){ 94 $del=mysql_query("DELETE FROM ".$prefix."_ele_widget WHERE id = '$row[id]'",$dbi); 100 $sql="DELETE FROM ".$prefix."_ele_widget WHERE id = '$row[id]'"; 101 $sth = $dbi->prepare("$sql"); 102 $sth->execute(); 95 103 } 96 104 } … … 105 113 106 114 107 $result = mysql_query("SELECT * FROM ".$prefix."_ele_widget order by pos_or,pos_ver asc", $dbi); 108 115 $sql="SELECT * FROM ".$prefix."_ele_widget order by pos_or,pos_ver asc"; 116 $sth = $dbi->prepare("$sql"); 117 $sth->execute(); 118 $row2 = $sth->fetchAll(); 109 119 110 120 … … 113 123 echo "<br><table border=\"0\" width=\"100%\">"; 114 124 echo "<tr bgcolor=\"$bgcolor2\"><td align=\"center\"><b>"._CONFIGWIDGET."</b></td></tr></table>"; 115 116 while ($row = mysql_fetch_array($result)) { 125 foreach($row2 as $row) { 117 126 echo "<form name=\"widget\" enctype=\"multipart/form-data\" method=\"post\" action=\"admin.php\">"; 118 127 echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; … … 163 172 if ($perms >128) { 164 173 165 $result = mysql_query("update ".$prefix."_ele_widget set titolo='$titolo', pos_or='$pos_or', pos_ver='$pos_ver', attivo='$attivo' where id='$idw'", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error()); 174 $sql="update ".$prefix."_ele_widget set titolo='$titolo', pos_or='$pos_or', pos_ver='$pos_ver', attivo='$attivo' where id='$idw'"; 175 $sth = $dbi->prepare("$sql"); 176 $sth->execute(); 166 177 167 178 Header("Location: admin.php?id_cons_gen=$id_cons_gen&op=widget"); … … 185 196 function make_db_widget(){ 186 197 global $dbi,$prefix; 187 $ result = mysql_query("CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget (198 $sql="CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget ( 188 199 `id` int(10) NOT NULL auto_increment, 189 200 `nome_file` varchar(255) NOT NULL default '', … … 193 204 `attivo` int(1) NOT NULL default '0', 194 205 PRIMARY KEY (`id`) 195 )",$dbi); 206 )"; 207 $sth = $dbi->prepare("$sql"); 208 $sth->execute(); 196 209 197 210
Note:
See TracChangeset
for help on using the changeset viewer.