summaryrefslogtreecommitdiffstats
path: root/lib/install.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-05 21:48:43 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-05 21:48:43 +0000
commita8589cef1e311a032a67ecdc61e2b73197373288 (patch)
treecfd486596c2126247acfca5a026db2c27cf06277 /lib/install.php
parentf24fa20acbd2d7ff7175dab391e75f743c634e87 (diff)
downloadampache-a8589cef1e311a032a67ecdc61e2b73197373288.tar.gz
ampache-a8589cef1e311a032a67ecdc61e2b73197373288.tar.bz2
ampache-a8589cef1e311a032a67ecdc61e2b73197373288.zip
working democratic play
Diffstat (limited to 'lib/install.php')
-rw-r--r--lib/install.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/install.php b/lib/install.php
index 70b38780..b9cf9cdd 100644
--- a/lib/install.php
+++ b/lib/install.php
@@ -236,15 +236,30 @@ function install_create_config($web_path,$username,$password,$hostname,$database
*/
function install_create_account($username,$password) {
+ if (!strlen($username) OR !strlen($password)) {
+ $GLOBALS['error']->add_error('general',"No Username/Password specified");
+ return false;
+ }
+
$results = read_config($GLOBALS['configfile'], 0, 0);
$dbh = check_database($results['local_host'],$results['local_username'],$results['local_pass']);
+
+ if (!is_resource($dbh)) {
+ $GLOBALS['error']->add_error('general','Database Connection Failed:' . mysql_error());
+ return false;
+ }
- @mysql_select_db($results['local_db'],$dbh);
+ $db_select = @mysql_select_db($results['local_db'],$dbh);
+
+ if (!$db_select) {
+ $GLOBALS['error']->add_error('general','Database Select Failed:' . mysql_error());
+ return false;
+ }
$username = sql_escape($username,$dbh);
$password = sql_escape($password,$dbh);
- $sql = "INSERT INTO user (`username`,`password`,`offset_limit`,`access`) VALUES ('$username',PASSWORD('$password'),'50','admin')";
+ $sql = "INSERT INTO user (`username`,`password`,`offset_limit`,`access`) VALUES ('$username',PASSWORD('$password'),'50','100')";
$db_results = mysql_query($sql, $dbh);
if (!$db_results) {