Changeset 376 for trunk/admin/admin.php
- Timestamp:
- Sep 24, 2022, 1:11:18 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r369 r376 135 135 } 136 136 137 138 139 140 try{ 141 $dbi = new PDO("mysql:host=$dbhost;charset=utf8", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); 142 $sql = "use $dbname"; 143 $dbi->exec($sql); 144 } 145 catch(PDOException $e) 146 { 147 echo $sql . "<br>" . $e->getMessage(); 148 } 149 $sth = $dbi->prepare("SET SESSION character_set_connection = 'utf8' "); 150 $sth->execute(); 151 $sth = $dbi->prepare("SET SESSION character_set_client = 'utf8' "); 152 $sth->execute(); 153 $sth = $dbi->prepare("SET SESSION character_set_database = 'utf8' "); 154 $sth->execute(); 155 $sth = $dbi->prepare("SET CHARACTER SET utf8"); 156 $sth->execute(); 157 158 $sth = $dbi->prepare("SET NAMES 'utf8'"); 159 $sth->execute(); 160 $sth = $dbi->prepare("select * from ".$prefix."_config"); 161 $sth->execute(); 162 137 $dsn = "mysql:host=$dbhost"; 138 $opt = [ 139 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 140 PDO::ATTR_EMULATE_PREPARES => false, 141 ]; 142 if($prefix == '') { 143 db_err ('stepBack','Non avete indicato il prefisso tabelle database.'); 144 } 145 try 146 { 147 $dbi = new PDO($dsn, $dbuname, $dbpass, $opt); 148 } 149 catch(PDOException $e) 150 { 151 echo $sql . "<br>" . $e->getMessage();die(); 152 } 153 $sql = "use $dbname"; 154 try 155 { 156 $dbi->exec($sql); 157 } 158 catch(PDOException $e) 159 { 160 echo $sql . "<br>" . $e->getMessage(); 161 } 162 $sth = $dbi->prepare("SET SESSION character_set_connection = 'utf8' "); 163 $sth->execute(); 164 $sth = $dbi->prepare("SET SESSION character_set_client = 'utf8' "); 165 $sth->execute(); 166 $sth = $dbi->prepare("SET SESSION character_set_database = 'utf8' "); 167 $sth->execute(); 168 $sth = $dbi->prepare("SET CHARACTER SET utf8"); 169 $sth->execute(); 170 171 $sth = $dbi->prepare("SET NAMES 'utf8'"); 172 $sth->execute(); 173 $sth = $dbi->prepare("select * from ".$prefix."_config"); 174 $sth->execute(); 175 163 176 # $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error()); 164 177 # mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error()); 165 178 ## mysql_query("SET NAMES 'utf8'", $dbi); 166 179 //---10/05/2009 gestione consultazione predefinita 167 168 169 170 171 180 $sth = $dbi->prepare("select * from ".$prefix."_config"); 181 $sth->execute(); 182 $row = $sth->fetch(PDO::FETCH_ASSOC); 183 #$row = $sth->fetchAll(); 184 $siteistat=$row['siteistat']; 172 185 if (!isset($_SESSION['id_comune'])){ 173 186 $_SESSION['sitename']=$row['sitename'];
Note:
See TracChangeset
for help on using the changeset viewer.