Exemplo n.º 1
0
Arquivo: index.php Projeto: VSG24/ccms
                Database connection could not be established.<br>
                <br>
                <span style="color: red;">Error:</span> {$db->connect_error}
            </div>
            <div>
            Please click 'Back' and review your settings.
                <a style="float: right" href="{$site_domain}c_install/index.php?switch=1" class="btn">Back</a>
            </div>
            <br>
</div>
HTML;
        echo $html;
        goto end;
    } else {
        require_once 'import_db.php';
        importDatabase();
    }
}
if (isset($_POST['admin_submit']) && isset($_SESSION['hash'])) {
    $hash = $_SESSION['hash'];
    $result = Users::submitNewUser($_POST['admin_username'], $_POST['admin_password'], $_POST['admin_email'], $_POST['admin_password2']);
    if ($result == 0) {
        $username = $_POST['admin_username'];
        $_SESSION['admin'] = $_POST['admin_username'];
        $query = "UPDATE c_users SET user_role = 4, activate = NULL WHERE user_login = '{$username}' LIMIT 1";
        $conn = MySQL::open_conn();
        $res = $conn->query($query);
        if ($res) {
            redirectTo('index.php?switch=3&hash=' . $_SESSION['hash']);
        } else {
            echo 'FATAL ERROR. CAN NOT CONTINUE. INSTALL ccms MANUALLY';
Exemplo n.º 2
0
function updateDatabase()
{
    global $cfg, $db;
    $query = @mysql_query('SHOW TABLES') or message(__FILE__, __LINE__, 'error', '[b]Failed to SHOW TABLES[/b]');
    if (mysql_fetch_row($query) == false) {
        importDatabase();
    }
    if ($cfg['database_version'] < 28 || $cfg['database_version'] > NJB_DATABASE_VERSION) {
        message(__FILE__, __LINE__, 'error', '[b]MySQL update error[/b][br]' . 'Incremental upgrade is not supported from this database version.' . '[list][*]Delete your old database.[*]On the next start O!MPD automatic creates a new MySQL database and table structure.[/list]');
    } else {
        for ($i = $cfg['database_version'] + 1; $i <= NJB_DATABASE_VERSION; $i++) {
            querySqlFile(NJB_HOME_DIR . 'sql/incremental_upgrade_' . str_pad($i, 2, '0', STR_PAD_LEFT) . '.sql');
        }
        loadServerSettings();
        message(__FILE__, __LINE__, 'ok', '[b]Incremental database upgrade successfuly on ' . $cfg['mysql_db'] . '@' . $cfg['mysql_host'] . '[/b][br]' . 'It is advisable to update de database now.' . '[list][*]Login with admin rights[*]Than select menu Config > Update[/list]');
    }
}