Changeset 253 for trunk/admin/admin.php


Ignore:
Timestamp:
Mar 12, 2018, 8:53:21 PM (7 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/admin.php

    r246 r253  
    133133
    134134
    135 
    136 
    137 
    138                 $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
    139                 mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
    140         mysql_query("SET NAMES 'utf8'", $dbi);
     135        try{
     136        $dbi = new PDO("mysql:host=$dbhost;charset=latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
     137        $sql = "use $dbname";
     138        $dbi->exec($sql);
     139        }
     140        catch(PDOException $e)
     141        {
     142            echo $sql . "<br>" . $e->getMessage();
     143        }                                                                                               
     144
     145
     146
     147#               $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
     148#               mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
     149##      mysql_query("SET NAMES 'utf8'", $dbi);
    141150//---10/05/2009  gestione consultazione predefinita
    142                 $res_config = mysql_query("select * from ".$prefix."_config ",$dbi);
    143                 list ($sitename,$siteurl,$site_logo,$slogan,$startdate,$adminmail,$tema,$foot,$language,$blocco
    144 ,$testata,$logo,$fileout,$copyright,$versione,$patch,$id_comune,$multicomune,$flash,$displayerrors,$editor,$tema_on,$ed_user) = mysql_fetch_row($res_config);
    145                 $siteistat=$id_comune;
     151        $sth = $dbi->prepare("select * from ".$prefix."_config");
     152        $sth->execute();
     153       
     154        $row = $sth->fetch(PDO::FETCH_ASSOC);   
     155#               $res_config = mysql_query("select * from ".$prefix."_config ",$dbi);
     156#               list ($sitename,$siteurl,$site_logo,$slogan,$startdate,$adminmail,$tema,$foot,$language,$blocco,$testata,$logo,$fileout,$copyright,$versione,$patch,$id_comune,$multicomune,$flash,$displayerrors,$editor,$tema_on,$ed_user) = ($res_config->fetch());
     157                $siteistat=$row['siteistat'];
    146158if (!isset($_SESSION['id_comune'])){
    147         $_SESSION['sitename']=$sitename;
    148         $_SESSION['siteurl']=$siteurl;
    149         $_SESSION['site_logo']=$site_logo;
    150         $_SESSION['slogan']=$slogan;
    151         $_SESSION['startdate']=$startdate;
    152         $_SESSION['adminmail']=$adminmail;
     159        $_SESSION['sitename']=$row['sitename'];
     160        $_SESSION['siteurl']=$row['siteurl'];
     161        $_SESSION['site_logo']=$row['site_logo'];
     162        $_SESSION['slogan']=$row['slogan'];
     163        $_SESSION['startdate']=$row['startdate'];
     164        $_SESSION['adminmail']=$row['adminmail'];
    153165        if ($tema=='facebook')
    154                 $_SESSION['tema']=$tema;
     166                $_SESSION['tema']=$row['tema'];
    155167        else $_SESSION['tema']='default';
    156         $_SESSION['foot']=$foot;
    157         $_SESSION['lang']=$language;
    158         $_SESSION['blocco']=$blocco;
    159         $_SESSION['testata']=$testata;
    160         $_SESSION['logo']=$logo;
    161         $_SESSION['fileout']=$fileout;
    162         $_SESSION['copyright']=$copyright;
    163         $_SESSION['versione']=$versione;
    164         $_SESSION['patch']=$patch;
    165         $_SESSION['id_comune']=$id_comune;
     168        $_SESSION['foot']=$row['foot'];
     169        $_SESSION['lang']=$row['language'];
     170        $_SESSION['blocco']=$row['blocco'];
     171        $_SESSION['testata']=$row['testata'];
     172        $_SESSION['logo']=$row['logo'];
     173        $_SESSION['fileout']=$row['fileout'];
     174        $_SESSION['copyright']=$row['copyright'];
     175        $_SESSION['versione']=$row['versione'];
     176        $_SESSION['patch']=$row['patch'];
     177        $_SESSION['id_comune']=$row['siteistat'];
    166178        $_SESSION['multicomune']=$multicomune;
    167179        $_SESSION['flash']=$flash;
     
    227239$dbi=$_SESSION['dbi'];
    228240$prefix=$_SESSION['prefix'];
    229 $id_comune=$_SESSION['id_comune'];
     241$id_comune=$_SESSION['id_comune'];die("qui");
    230242if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']);
    231243else {
Note: See TracChangeset for help on using the changeset viewer.