Пример #1
0
 $config_file = str_replace("_DB_PASSWORD_", $database_password, $config_file);
 if (!copy('../sysconfig.local.inc-sample.php', $config_file_path)) {
     $error_mg[] = "<li>Could not create file " . $config_file_name . "! Please check if the sysconfig.local.inc-sample.php file is exists</li>";
 } else {
     @chmod($config_file_path, 0777);
     $f = @fopen($config_file_path, "w+");
     if (@fwrite($f, $config_file) > 0) {
         $link = @mysql_connect($database_host, $database_username, $database_password);
         if ($link) {
             if (@mysql_select_db($database_name)) {
                 if (false == ($db_error = apphp_db_install_core($database_name, $sql_dump))) {
                     $error_mg[] = "<li>Could not read file " . $sql_dump . "! Please check if the file exists</li>";
                     @unlink($config_file_path);
                 } else {
                     if ($_POST['install_sample'] == 'yes') {
                         if (false == ($db_error = apphp_db_install($database_name, $sql_sample))) {
                             $error_mg[] = "<li>Could not read file " . $sql_sample . "! Please check if the file exists</li>";
                         } else {
                             $completed = true;
                         }
                     } else {
                         $completed = true;
                     }
                     if (!empty($retype_password)) {
                         apphp_db_query($sql_update, $link);
                     }
                 }
             } else {
                 $error_mg[] = "<li>Database connecting error! Check your database exists.</li>";
                 @unlink($config_file_path);
             }
Пример #2
0
 $config_file = str_replace('<DB_PREFIX>', $database_prefix, $config_file);
 $config_file = str_replace('<ENCRYPTION>', EI_USE_PASSWORD_ENCRYPTION ? 'true' : 'false', $config_file);
 $config_file = str_replace('<ENCRYPTION_TYPE>', $password_encryption, $config_file);
 $config_file = str_replace('<ENCRYPT_KEY>', EI_PASSWORD_ENCRYPTION_KEY, $config_file);
 $config_file = str_replace('<INSTALLATION_KEY>', random_string(10), $config_file);
 @chmod(EI_CONFIG_FILE_PATH, 0755);
 $f = @fopen(EI_CONFIG_FILE_PATH, 'w+');
 if (@fwrite($f, $config_file) > 0) {
     @chmod(EI_CONFIG_FILE_DIRECTORY, 0755);
     $link = @mysql_connect($database_host, $database_username, $database_password);
     if ($link) {
         if (@mysql_select_db($database_name)) {
             // read sql dump file
             $sql_dump = file_get_contents($sql_dump_file);
             if ($sql_dump != '') {
                 if (false == ($db_error = apphp_db_install($sql_dump_file))) {
                     $error_mg[] = 'SQL execution error! Please check carefully a syntax of SQL dump file.';
                 } else {
                     // additional operations, like setting up system preferences etc.
                     // ...
                     // ...
                     $completed = true;
                 }
             } else {
                 $error_mg[] = 'Could not read file ' . $sql_dump_file . '! Please check if a file exists.';
             }
         } else {
             if (EI_MODE == 'debug') {
                 $error_mg[] = 'Database connecting error! Please check your database exists. <br />Error: ' . mysql_error() . '</span><br />';
             } else {
                 $error_mg[] = 'Database connecting error! Please check your database exists.</span><br />';