Example #1
0
    }
}
if (isset($_POST['step']) && $_POST['step'] == "3") {
    function createRandomPrefix($length = 5)
    {
        $chars = array("abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ", "123456789");
        $count = array(strlen($chars[0]) - 1, strlen($chars[1]) - 1);
        $prefix = "";
        for ($i = 0; $i < $length; $i++) {
            $type = mt_rand(0, 1);
            $prefix .= substr($chars[$type], mt_rand(0, $count[$type]), 1);
        }
        return $prefix;
    }
    $db_prefix = "fusion" . createRandomPrefix() . "_";
    $cookie_prefix = "fusion" . createRandomPrefix() . "_";
    $db_host = isset($_POST['db_host']) ? stripinput(trim($_POST['db_host'])) : "localhost";
    $db_user = isset($_POST['db_user']) ? stripinput(trim($_POST['db_user'])) : "";
    $db_name = isset($_POST['db_name']) ? stripinput(trim($_POST['db_name'])) : "";
    $db_prefix = isset($_POST['db_prefix']) ? stripinput(trim($_POST['db_prefix'])) : $db_prefix;
    $cookie_prefix = isset($_POST['cookie_prefix']) ? stripinput(trim($_POST['cookie_prefix'])) : $cookie_prefix;
    $db_error = isset($_POST['db_error']) && isnum($_POST['db_error']) ? $_POST['db_error'] : "0";
    $field_class = array("", "", "", "", "");
    if ($db_error > "0") {
        $field_class[2] = " tbl-error";
        if ($db_error == 1) {
            $field_class[1] = " tbl-error";
            $field_class[2] = " tbl-error";
        } elseif ($db_error == 2) {
            $field_class[3] = " tbl-error";
        } elseif ($db_error == 3) {
Example #2
0
 }
 if ($db_prefix != "") {
     $db_prefix_last = $db_prefix[strlen($db_prefix) - 1];
     if ($db_prefix_last != "_") {
         $db_prefix = $db_prefix . "_";
     }
 }
 if ($cookie_prefix != "") {
     $cookie_prefix_last = $cookie_prefix[strlen($cookie_prefix) - 1];
     if ($cookie_prefix_last != "_") {
         $cookie_prefix = $cookie_prefix . "_";
     }
 }
 $selected_langs = '';
 $secret_key = createRandomPrefix(32);
 $secret_key_salt = createRandomPrefix(32);
 if ($db_host != "" && $db_user != "" && $db_name != "" && $db_prefix != "") {
     $connection_info = dbconnect($db_host, $db_user, $db_pass, $db_name, FALSE);
     $db_connect = $connection_info['connection_success'];
     $db_select = $connection_info['dbselection_success'];
     if ($db_connect) {
         if ($db_select) {
             $countRows = dbrows(dbquery("SHOW TABLES LIKE '" . str_replace("_", "\\_", $db_prefix) . "%'"));
             if (!$countRows) {
                 $table_name = uniqid($db_prefix, FALSE);
                 $can_write = TRUE;
                 $result = dbquery("CREATE TABLE " . $table_name . " (test_field VARCHAR(10) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci");
                 if (!$result) {
                     $can_write = FALSE;
                 }
                 $result = dbquery("DROP TABLE " . $table_name);