diff --git a/install/class.create_db.php b/install/class.create_db.php index 07c3f78b..0b03b46e 100644 --- a/install/class.create_db.php +++ b/install/class.create_db.php @@ -49,7 +49,7 @@ public static function create_database($root,$root_pass,$user,$pass,$db,$db_type $db_type = filter_var($db_type,FILTER_SANITIZE_STRING); $host = filter_var($host,FILTER_SANITIZE_STRING); // Dirty hack - if ($host != 'localhost' || $host != '127.0.0.1') { + if ($host != 'localhost' && $host != '127.0.0.1') { $grantright = $_SERVER['SERVER_ADDR']; } else $grantright = 'localhost'; try { @@ -57,6 +57,7 @@ public static function create_database($root,$root_pass,$user,$pass,$db,$db_type $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($db_type == 'mysql') { $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); + if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); } else if ($db_type == 'pgsql') { $dbh->exec("CREATE DATABASE ".$db."; CREATE USER ".$user." WITH PASSWORD '".$password."'; diff --git a/install/index.php b/install/index.php index 8390ea38..df267775 100644 --- a/install/index.php +++ b/install/index.php @@ -28,6 +28,11 @@ require('../footer.php'); exit; } +if (!is_writable('tmp')) { + print '<div class="info column"><p><strong>The directory <i>install/tmp</i> must be writable.</strong></p></div>'; + require('../footer.php'); + exit; +} if (!set_time_limit(0)) { print '<div class="info column"><p><strong>You may need to update the maximum execution time.</strong></p></div>'; } @@ -544,7 +549,7 @@ <label for="aircrafticoncolor">Color of aircraft icon on map</label> <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> <?php - if (!is_writable('cache')) { + if (!is_writable('../cache')) { ?> <b>The directory cache is not writable, aircraft icon will not be cached</b> <?php