Changeset 381 for trunk/install
- Timestamp:
- Oct 28, 2022, 7:14:26 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/install/install2.php
r376 r381 52 52 } 53 53 $dsn = "mysql:host=$DBhostname"; #dbname=$DBname"; 54 $opt = [ 55 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 56 PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, 57 PDO::ATTR_EMULATE_PREPARES => false, 58 ]; 54 $opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false); 59 55 $user=$DBuserName; 60 56 $password=$DBpassword; … … 66 62 $database = new PDO($dsn, $user, $password, $opt); 67 63 } 68 catch(PDOException $e) 69 { 70 echo $sql . "<br>" . $e->getMessage();die(); 71 } 72 #sostituire questa riga con le variabili per il nuovo utente e la sua password da inserire nella pagina precedente 73 ######################################## 74 # $DBuserName='eleuser'; $DBpassword='elepass'; 64 catch(PDOException $e) 65 { 66 echo $sql . "<br>" . $e->getMessage();die(); 67 } 75 68 try{ 76 69 $sql = "CREATE DATABASE IF NOT EXISTS $DBname;"; … … 81 74 echo $sql . "<br>" . $e->getMessage();die(); 82 75 } 83 try { 84 $sql="CREATE USER if not exists `$ELEuserName`@'$DBhostname' IDENTIFIED BY '$ELEpassword';"; 85 $database->exec($sql); 86 # $sql= "GRANT ALL ON `$DBname`.* TO `roby`@'$DBhostname';"; 87 # $database->exec($sql); 88 $sql= "GRANT ALL ON `$DBname`.* TO `$ELEuserName`@'$DBhostname';"; 89 $database->exec($sql); 90 $sql= "FLUSH PRIVILEGES;"; 91 $database->exec($sql); 92 $sql = "use $DBname"; 93 $database->exec($sql); 76 if(phpversion()>="5.7.6") 77 { 78 try { 79 $sql="CREATE USER if not exists '$ELEuserName'@'$DBhostname' IDENTIFIED BY '$ELEpassword';"; 80 $database->exec($sql); 81 } 82 catch(PDOException $e) 83 { 84 echo $sql . "<br>" . $e->getMessage();die(); 85 } 86 try { 87 $sql= "GRANT ALL ON `$DBname`.* TO `$ELEuserName`@'$DBhostname';"; 88 $database->exec($sql); 89 } 90 catch(PDOException $e) 91 { 92 echo $sql . "<br>" . $e->getMessage();die(); 93 } 94 }else{ 95 try { 96 $sql="grant all on `$DBname`.* TO '$ELEuserName'@'$DBhostname' IDENTIFIED BY '$ELEpassword';"; 97 $database->exec($sql); 98 } 99 catch(PDOException $e) 100 { 101 echo $sql . "<br>" . $e->getMessage();die(); 102 } 103 } 104 $sql= "FLUSH PRIVILEGES;"; 105 $database->exec($sql); 106 $sql = "use $DBname"; 107 $database->exec($sql); 94 108 $sql = file_get_contents('sql/eleonline.sql'); 95 109 $qr = $database->exec($sql); 96 110 $DBcreated = 1; 97 }98 catch(PDOException $e)99 {100 echo $sql . "<br>" . $e->getMessage();die();101 }102 111 } 103 112 … … 322 331 <td width="100">Numero Istat</td> 323 332 <td align="left"><input class="inputbox" type="text" name="istat" size="6" value="<?php echo "{$configArray['istat']}"; ?>" /> 324 <a href="http ://www.istat.it/strumenti/definizioni/comuni/" target="_blank">Preleva i codici Istat dei comuni italiani</a>333 <a href="https://www.istat.it/it/archivio/6789" target="_blank">Preleva i codici Istat dei comuni italiani</a> 325 334 </td><td></td> 326 335 </tr>
Note:
See TracChangeset
for help on using the changeset viewer.