From d746189199b078c4a78ef748728f259ade1ced67 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Fri, 19 Feb 2016 00:22:36 +0100 Subject: [PATCH] Add both user, check tmp writable --- install/class.create_db.php | 3 ++- install/index.php | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 '

The directory install/tmp must be writable.

'; + require('../footer.php'); + exit; +} if (!set_time_limit(0)) { print '

You may need to update the maximum execution time.

'; } @@ -544,7 +549,7 @@ The directory cache is not writable, aircraft icon will not be cached