install/index.php
changeset 150 59c42a716f95
parent 149 0f9739c8db48
child 151 b8adc3cf28c7
equal deleted inserted replaced
149:0f9739c8db48 150:59c42a716f95
    23 	case 1:
    23 	case 1:
    24 		$step++;
    24 		$step++;
    25 		echo "<p>This installer expects you to have a PowerDNS database accessable from this server. This installer also expects you to have never ran Poweradmin before, or that you want to overwrite the Poweradmin part of the database. If you have had Poweradmin running before, any data in the following tables will be destroyed:</p>\n";
    25 		echo "<p>This installer expects you to have a PowerDNS database accessable from this server. This installer also expects you to have never ran Poweradmin before, or that you want to overwrite the Poweradmin part of the database. If you have had Poweradmin running before, any data in the following tables will be destroyed:</p>\n";
    26 		echo "<ul><li>perm_items</li><li>perm_templ</li><li>perm_templ_items</li><li>users</li><li>zones</li></ul>\n";
    26 		echo "<ul><li>perm_items</li><li>perm_templ</li><li>perm_templ_items</li><li>users</li><li>zones</li></ul>\n";
    27 		echo "<p>This installer will, of course, not touch the data in the PowerDNS tables of the database. However, it is, of course, recommended you create a backup of your database before proceeding.</p>";
    27 		echo "<p>This installer will, of course, not touch the data in the PowerDNS tables of the database. However, it is, of course, recommended you create a backup of your database before proceeding.</p>";
    28 		echo "<p>Finaly, if you see any errors during the installation process, a problem report would be. You can report problems (and ask for help) on the <a href=\"https://www.poweradmin.org/trac/wiki/Mailinglists\">poweradmin-users</a> mailinglist or you can create <a href=\"https://www.poweradmin.org/trac/newticket\">a ticket</a> in the ticketsystem.</p>";
    28 		echo "<p>Finally, if you see any errors during the installation process, a problem report would be. You can report problems (and ask for help) on the <a href=\"https://www.poweradmin.org/trac/wiki/Mailinglists\">poweradmin-users</a> mailinglist or you can create <a href=\"https://www.poweradmin.org/trac/newticket\">a ticket</a> in the ticketsystem.</p>";
    29 		echo "<p>Do you want to proceed now?</p>\n";
    29 		echo "<p>Do you want to proceed now?</p>\n";
    30 		echo "<form method=\"post\">";
    30 		echo "<form method=\"post\">";
    31 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
    31 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
    32 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
    32 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
    33 		echo "</form>";
    33 		echo "</form>";
   122 		echo "</form>";
   122 		echo "</form>";
   123 		break;
   123 		break;
   124 
   124 
   125 	case 5:
   125 	case 5:
   126 		$step++;
   126 		$step++;
   127 		echo "<p>The configuration is printed here. You should now create the file " . $local_config_file . " in the Poweradmin root directory yourself. It should contain the following few lines:</p>";
   127 		$config = "<?\n\n" .
   128 
   128 			"\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" .
   129 		echo "<pre>";
       
   130 		echo "\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" .
       
   131 			"\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" .
   129 			"\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" .
   132 			"\$db_pass\t\t= \"" . $_POST['db_pass'] . "\";\n" .
   130 			"\$db_pass\t\t= \"" . $_POST['db_pass'] . "\";\n" .
   133 			"\$db_name\t\t= \"" . $_POST['db_name'] . "\";\n" .
   131 			"\$db_name\t\t= \"" . $_POST['db_name'] . "\";\n" .
   134 			"\$db_type\t\t= \"" . $_POST['db_type'] . "\";\n" .
   132 			"\$db_type\t\t= \"" . $_POST['db_type'] . "\";\n" .
   135 			"\n" .
   133 			"\n" .
   136 			"\$dns_hostmaster\t\t= \"" . $_POST['dns_hostmaster'] . "\";\n" .
   134 			"\$dns_hostmaster\t\t= \"" . $_POST['dns_hostmaster'] . "\";\n" .
   137 			"\$dns_ns1\t\t= \"" . $_POST['dns_ns1'] . "\";\n" .
   135 			"\$dns_ns1\t\t= \"" . $_POST['dns_ns1'] . "\";\n" .
   138 			"\$dns_ns2\t\t= \"" . $_POST['dns_ns2'] . "\";\n" .
   136 			"\$dns_ns2\t\t= \"" . $_POST['dns_ns2'] . "\";\n" .
   139 			"\n";
   137 			"\n?>\n";
   140 		echo "</pre>";
   138 
       
   139 		if (is_writeable($local_config_file)) {
       
   140 			$h_config = fopen($local_config_file, "w");
       
   141 			fwrite($h_config, $config);
       
   142 			fclose($h_config);
       
   143 			echo "<p>The installer was able to write to the file \"" . $local_config_file . "\". A basic configuration, based on the details you have given, has been created.</p>\n";
       
   144 		} else {
       
   145 			echo "<p>The installer is unable to write to the file \"" . $local_config_file . "\" (which is in itself good). The configuration is printed here. You should now create the file " . $local_config_file . " in the Poweradmin root directory yourself. It should contain the following few lines:</p>\n";
       
   146 			echo "<pre>";
       
   147 			echo $config;
       
   148 			echo "</pre>";
       
   149 		};
   141 		echo "<form method=\"post\">";
   150 		echo "<form method=\"post\">";
   142 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   151 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
   143 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
   152 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
   144 		echo "</form>";
   153 		echo "</form>";
   145 		break;
   154 		break;
   146 
   155 
   147 	case 6:
   156 	case 6:
   148 		$step++;
   157 		$step++;
   149 		echo "<p>Now we have finished the configuration, you should remove the directory \"install/\" from the Poweradmin root directory. You will not be able to use the file if it exists. Do it now.</p>";
   158 		echo "<p>Now we have finished the configuration, you should (must!) remove the directory \"install/\" from the Poweradmin root directory. You will not be able to use the file if it exists. Do it now.</p>";
   150 		echo "<p>After you have removed the file, you can login to <a href=\"index.php\">Poweradmin</a> with username \"admin\" and password \"admin\". You are highly encouraged to change these as soon as you are logged in.</p>";
   159 		echo "<p>After you have removed the file, you can login to <a href=\"index.php\">Poweradmin</a> with username \"admin\" and password \"admin\". You are highly encouraged to change these as soon as you are logged in.</p>";
   151 		break;
   160 		break;
   152 
   161 
   153 	default:
   162 	default:
   154 		break;
   163 		break;