diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-04-21 03:21:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-04-21 03:21:20 +0000 |
commit | 310adfa35923938b97ea416cd21c431d64eaa05a (patch) | |
tree | 245aba68464905bdb5d0072918aa0f5b621290cb /lib/install.php | |
parent | 67981be0c675d0685bc6e986e6cf5e5fb6cae611 (diff) | |
download | ampache-310adfa35923938b97ea416cd21c431d64eaa05a.tar.gz ampache-310adfa35923938b97ea416cd21c431d64eaa05a.tar.bz2 ampache-310adfa35923938b97ea416cd21c431d64eaa05a.zip |
last commit before beta3 release
Diffstat (limited to 'lib/install.php')
-rw-r--r-- | lib/install.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/install.php b/lib/install.php index 6bfc2f6f..ae873a46 100644 --- a/lib/install.php +++ b/lib/install.php @@ -136,14 +136,24 @@ function install_insert_db($username,$password,$hostname,$database) { Error::add('general','Error: Database Already exists and Overwrite not checked'); return false; } - if (!$db_selected) { - $sql = "CREATE DATABASE `" . $database . "`"; + elseif (!$db_selected) { + $sql = "CREATE DATABASE `" . Dba::escape($database) . "`"; if (!$db_results = @mysql_query($sql, $dbh)) { Error::add('general',"Error: Unable to Create Database " . mysql_error()); return false; } @mysql_select_db($database, $dbh); } // if db can't be selected + else { + $sql = "DROP DATABASE `" . Dba::escape($database) . "`"; + $db_results = @mysql_query($sql,$dbh); + $sql = "CREATE DATABASE `" . Dba::escape($database) . "`"; + if (!$db_results = @mysql_query($sql, $dbh)) { + Error::add('general',"Error: Unable to Create Database " . mysql_error()); + return false; + } + @mysql_select_db($database, $dbh); + } // end if selected and overwrite /* Check and see if we should create a user here */ if ($_REQUEST['db_user'] == 'create_db_user') { |