Пример #1
0
 // 15 - Database - config-file
 sendHead(" - Database");
 send("<h1>" . _TITLE . "</h1>");
 send("<h2>Database - Config-File</h2>");
 $oldpath = $_REQUEST["oldpath"];
 $type = $_REQUEST["db_type"];
 $host = $_REQUEST["db_host"];
 $name = $_REQUEST["db_name"];
 $user = $_REQUEST["db_user"];
 $pass = $_REQUEST["db_pass"];
 $pcon = $_REQUEST["db_pcon"];
 // write file
 $databaseConfWriteOk = false;
 $databaseConfWriteError = "";
 $databaseConfContent = "";
 writeDatabaseConfig($type, $host, $user, $pass, $name, $pcon);
 // output
 if ($databaseConfWriteOk) {
     send('<font color="green"><strong>Ok</strong></font><br>');
     send('database-config-file <em>' . _DIR . _FILE_DBCONF . '</em> written.');
 } else {
     send('<font color="red"><strong>Error</strong></font><br>');
     send($databaseConfWriteError . "<p>");
     send('to perform this step manual paste the following content to the database-config-file <em>' . _DIR . _FILE_DBCONF . '</em> : <p>');
     send('<textarea cols="81" rows="33">' . $databaseConfContent . '</textarea>');
     send("<p>Note : You must write this file before you can continue !");
 }
 send("<h2>Next : Create/Alter Tables</h2>");
 send('<form name="setup" action="' . _FILE_THIS . '" method="post">');
 send('<input type="Hidden" name="oldpath" value="' . $oldpath . '">');
 send('<input type="Hidden" name="16" value="">');
Пример #2
0
    echo $result;
    exit;
}
// gui installer
if (!isset($_SESSION['install_screen'])) {
    $_SESSION['install_screen'] = 1;
} else {
    if (isset($_REQUEST['screen']) && $_REQUEST['screen'] != "") {
        $_SESSION['install_screen'] = $_REQUEST['screen'];
    }
}
if (isset($_REQUEST['checkdb'])) {
    // check database config, if successful write config file and proceed to the next screen
    $dbresult = DbConfig::testConf($_REQUEST['host'], $_REQUEST['port'], $_REQUEST['database'], $_REQUEST['username'], $_REQUEST['password']);
    if ($dbresult === true) {
        if (writeDatabaseConfig()) {
            $_SESSION['install_screen'] = 3;
        } else {
            $errormessage = "Failed to write database configuration file";
        }
    } else {
        $errormessage = $dbresult;
    }
}
if (isset($_REQUEST['doinstall'])) {
    $_SESSION['setupvars'] = json_encode(["adminhash" => hash('sha256', $_REQUEST['password'])]);
    $_SESSION['install_screen'] = 4;
}
if (isset($_REQUEST['doupgrade'])) {
    $_SESSION['setupvars'] = json_encode(["adminhash" => hash('sha256', $_REQUEST['password'])]);
    $_SESSION['install_screen'] = 4;