Error: Could not connect to the database please make sure the database server, username and password is correct!' . "\n";
} elseif (!@mysql_select_db($_POST['db_database'], $connection)) {
@$error['warning'] = 'Error: Database does not exist!
' . "\n";
}
} elseif ((!is_writable(@$_POST['directory'] . '/config.php')) || (!is_writable(@$_POST['directory'] . '/admin/config.php'))) {
@$error['warning'] = 'Error: Could not write to config.php please check you have set the correct premissions on:
' . "\n";
@$error['warning'] .= '' . "\n";
@$error['warning'] .= ' - ' . @$_POST['directory'] . 'config.php
' . "\n";
@$error['warning'] .= ' - ' . @$_POST['directory'] . 'admin/config.php
' . "\n";
@$error['warning'] .= '
' . "\n";
}
if (!$error) {
if ($sql = file($_POST['directory'] . 'install/opencart.sql')) {
$query = '';
foreach($sql as $line) {
$tsl = trim($line);
if (($sql != '') && (substr($tsl, 0, 2) != "--") && (substr($tsl, 0, 1) != '#')) {
$query .= $line;
if (preg_match('/;\s*$/', $line)) {
$result = mysql_query($query, $connection);
if (!$result) {
die(mysql_error());
}
$query = '';
}
}
}
mysql_query("insert into `user` set user_group_id = '1', username = '" . mysql_real_escape_string($_POST['username']) . "', password = '" . mysql_real_escape_string(md5($_POST['password'])) . "', date_added = now()", $connection);
echo mysql_error();
mysql_close($connection);
}
if (file_exists($_POST['directory'] . 'config.php')) {
ob_start();
echo '
// HTTP
define('HTTP_SERVER', '');
define('HTTP_IMAGE', '');
// HTTPS
define('HTTPS_SERVER', '');
define('HTTPS_IMAGE', '');
// DIR
define('DIR_IMAGE', '');
define('DIR_CACHE', '');
define('DIR_INCLUDE', '');
define('DIR_SERVICE', '');
define('DIR_LANGUAGE', '');
define('DIR_MODULE', '');
define('DIR_PLUGIN', '');
define('DIR_TEMPLATE', '');
// Database
define('DB_SERVER', '');
define('DB_USERNAME', '');
define('DB_PASSWORD', '');
define('DB_DATABASE', '');
';
$config = ob_get_contents();
ob_end_clean();
$file = @fopen($_POST['directory'] . 'config.php', 'w');
fwrite($file, $config);
fclose($file);
}
if (file_exists($_POST['directory'] . 'admin/config.php')) {
ob_start();
echo '
// HTTP
define('HTTP_SERVER', '');
define('HTTP_CATALOG', '');
define('HTTP_IMAGE', '');
// HTTPS
define('HTTPS_SERVER', '');
define('HTTPS_IMAGE', '');
// DIR
define('DIR_IMAGE', '');
define('DIR_CACHE', '');
define('DIR_INCLUDE', '');
define('DIR_LANGUAGE', '');
define('DIR_MODULE', '');
define('DIR_PLUGIN', '');
define('DIR_TEMPLATE', '');
// Catalog
define('DIR_CATALOG_TEMPLATE', '');
define('DIR_CATALOG_LANGUAGE', '');
define('DIR_CATALOG_SERVICE', '');
// Database
define('DB_SERVER', '');
define('DB_USERNAME', '');
define('DB_PASSWORD', '');
define('DB_DATABASE', '');
';
$config = ob_get_contents();
ob_end_clean();
$file = @fopen($_POST['directory'] . 'admin/config.php', 'w');
fwrite($file, $config);
fclose($file);
}
}
}
if ((!$_POST) || ($error)) {
?>
Congratulations
You have successfully installed OpenCart!
Don't forget to remove your installation directory!

Online Shop

Administration