Exemplo n.º 1
0
    ?>
    </td>
    <td>
    <?php 
    echo T_('This attempts to connect to your database using the values read from your configuration file.');
    ?>
    </td>
</tr>
<tr>
    <td valign="top"><?php 
    echo T_('Database tables');
    ?>
</td>
    <td valign="top">
    <?php 
    echo debug_result(check_php_pdo() && Dba::check_database_inserted());
    ?>
    </td>
    <td>
    <?php 
    echo T_('This checks a few key tables to make sure that you have successfully inserted the Ampache database and that the user has access to the database');
    ?>
    </td>
</tr>
<tr>

    <td valign="top"><?php 
    echo T_('Web path');
    ?>
</td>
    <td valign="top">
Exemplo n.º 2
0
/**
 * install_create_account
 * this creates your initial account and sets up the preferences for the -1 user and you
 */
function install_create_account($username, $password, $password2)
{
    if (!strlen($username) or !strlen($password)) {
        Error::add('general', T_('No Username/Password specified'));
        return false;
    }
    if ($password !== $password2) {
        Error::add('general', T_('Passwords do not match'));
        return false;
    }
    if (!Dba::check_database()) {
        Error::add('general', sprintf(T_('Database connection failed: %s'), Dba::error()));
        return false;
    }
    if (!Dba::check_database_inserted()) {
        Error::add('general', sprintf(T_('Database select failed: %s'), Dba::error()));
        return false;
    }
    $username = Dba::escape($username);
    $password = Dba::escape($password);
    $insert_id = User::create($username, 'Administrator', '', '', $password, '100');
    if (!$insert_id) {
        Error::add('general', sprintf(T_('Administrative user creation failed: %s'), Dba::error()));
        return false;
    }
    // Fix the system users preferences
    User::fix_preferences('-1');
    return true;
}