Ignore:
Timestamp:
Jan 16, 2019, 7:06:35 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/ele_widget.php

    r53 r256  
    1515// Offset - visualizza il numero di elementi per pagina
    1616$offset=5;
    17 
     17global $dbi;
    1818$aid=$_SESSION['aid'];
    19 $dbi=$_SESSION['dbi'];
    2019$prefix=$_SESSION['prefix'];
    2120$currentlang=$_SESSION['lang'];
     
    2625
    2726$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);
    3028
    3129include("modules/Elezioni/funzionidata.php");
    3230include("modules/Elezioni/ele.php");
     31$row=cur_cons();
     32$tipo_cons=$row[0];$id_cons=$row[1];
    3333
    3434if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do='';
     
    6464                    $files=$tlist[$i];
    6565                   
    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];
    6871                    $id = intval($idwid);
    6972
    70 
    7173                    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();                  }
    7477                 
    7578                 
     
    8487 
    8588                  # 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){
    8894                        $esi=0;
    8995                        for ($i=0; $i < sizeof($tlist); $i++) {
     
    9298                        }
    9399                        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();       
    95103                      }
    96104                }
     
    105113
    106114       
    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();       
    109119       
    110120
     
    113123        echo "<br><table border=\"0\" width=\"100%\">";
    114124        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) {
    117126            echo "<form name=\"widget\" enctype=\"multipart/form-data\" method=\"post\" action=\"admin.php\">";
    118127            echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
     
    163172        if ($perms >128) {
    164173                               
    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();
    166177
    167178                Header("Location: admin.php?id_cons_gen=$id_cons_gen&op=widget");
     
    185196function make_db_widget(){
    186197global $dbi,$prefix;
    187 $result = mysql_query("CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget (
     198$sql="CREATE TABLE IF NOT EXISTS ".$prefix."_ele_widget (
    188199  `id` int(10) NOT NULL auto_increment,
    189200  `nome_file` varchar(255) NOT NULL default '',
     
    193204 `attivo` int(1) NOT NULL default '0',
    194205  PRIMARY KEY  (`id`)
    195 )",$dbi);
     206)";
     207$sth = $dbi->prepare("$sql");
     208$sth->execute();
    196209
    197210
Note: See TracChangeset for help on using the changeset viewer.