. */ /* */ /*************************************************************************************/ $step=4; include("header.php"); if (isset($_POST['host']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['port'])){ $_SESSION['install']['host'] = $_POST['host']; $_SESSION['install']['username'] = $_POST['username']; $_SESSION['install']['password'] = $_POST['password']; $_SESSION['install']['port'] = $_POST['port']; $checkConnection = new \Thelia\Install\CheckDatabaseConnection($_POST['host'], $_POST['username'], $_POST['password'], $_POST['port']); if(!$checkConnection->exec()) { header('location: connection.php?err=1'); exit; } $databases = $checkConnection->getConnection()->query('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA'); if(false === $databases){ header('location: connection.php?err=1'); exit; } } elseif($_SESSION['install']['step'] >=3) { $checkConnection = new \Thelia\Install\CheckDatabaseConnection($_SESSION['install']['host'], $_SESSION['install']['username'], $_SESSION['install']['password'], $_SESSION['install']['port']); } else { header('location: connection.php?err=1'); exit; } $_SESSION['install']['step'] = 4; $connection = $checkConnection->getConnection(); ?>
trans('Choose your database'); ?>

trans('The SQL server contains multiple databases.'); ?>
trans('Select below the one you want to use.'); ?>

exec(sprintf('use %s', $database['SCHEMA_NAME'])); $tables = $connection->query('SHOW TABLES'); $found = false; foreach($tables as $table) { if($table[0] == 'cart_item') { $found = true; break; } } ?>
exec('use information_schema'); $permissions = $connection->query("SELECT COUNT( * ) FROM `USER_PRIVILEGES` WHERE PRIVILEGE_TYPE = 'CREATE' AND GRANTEE LIKE '%".$_SESSION['install']['username']."%' AND IS_GRANTABLE = 'YES';"); $writePermission = false; if($permissions->fetchColumn(0) > 0) { ?>

trans('or'); ?>