install/index.php
changeset 146 0756319df2d0
parent 142 edd0c3ee3e1d
child 149 0f9739c8db48
equal deleted inserted replaced
145:6190c9a5f48b 146:0756319df2d0
    39 		echo "<table>\n";
    39 		echo "<table>\n";
    40 		echo "<tr><td>Username</td><td><input type=\"text\" name=\"user\" value=\"\"></td><td>The username to use to connect to the database, make sure the username has sufficient rights to perform administrative task to the PowerDNS database (e.g. \"root\").</td></tr>\n";
    40 		echo "<tr><td>Username</td><td><input type=\"text\" name=\"user\" value=\"\"></td><td>The username to use to connect to the database, make sure the username has sufficient rights to perform administrative task to the PowerDNS database (e.g. \"root\").</td></tr>\n";
    41 		echo "<tr><td>Password</td><td><input type=\"password\" name=\"pass\" value=\"\"></td><td>The password for this username.</td></tr>\n";
    41 		echo "<tr><td>Password</td><td><input type=\"password\" name=\"pass\" value=\"\"></td><td>The password for this username.</td></tr>\n";
    42 		echo "<tr><td>Hostname</td><td><input type=\"text\" name=\"host\" value=\"\"></td><td>The hostname on which the PowerDNS database resides. Frequently, this will be \"localhost\".</td></tr>\n";
    42 		echo "<tr><td>Hostname</td><td><input type=\"text\" name=\"host\" value=\"\"></td><td>The hostname on which the PowerDNS database resides. Frequently, this will be \"localhost\".</td></tr>\n";
    43 		echo "<tr><td>Database</td><td><input type=\"text\" name=\"name\" value=\"\"></td><td>The name of the PowerDNS database.</td></tr>\n";
    43 		echo "<tr><td>Database</td><td><input type=\"text\" name=\"name\" value=\"\"></td><td>The name of the PowerDNS database.</td></tr>\n";
       
    44 		echo "<tr><td>Database type</td><td><select name=\"type\"><option value=\"mysql\">MySQL</option><option value=\"pgsql\">PostgreSQL</option></td><td>The type PowerDNS database.</td></tr>\n";
    44 		echo "</table>\n";
    45 		echo "</table>\n";
    45 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
    46 		echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">";
    46 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
    47 		echo "<input type=\"submit\" name=\"submit\" value=\"Go to step " . $step . "\">";
    47 		echo "</form>";
    48 		echo "</form>";
    48 		break;
    49 		break;
    54 		include_once("database-structure.inc.php");
    55 		include_once("database-structure.inc.php");
    55 		$db_user = $_POST['user'];
    56 		$db_user = $_POST['user'];
    56 		$db_pass = $_POST['pass'];
    57 		$db_pass = $_POST['pass'];
    57 		$db_host = $_POST['host'];
    58 		$db_host = $_POST['host'];
    58 		$db_name = $_POST['name'];
    59 		$db_name = $_POST['name'];
    59 		$db_type = "mysql";
    60 		$db_type = $_POST['type'];
    60 		require_once("../inc/database.inc.php");
    61 		require_once("../inc/database.inc.php");
    61 		$db = dbConnect();
    62 		$db = dbConnect();
    62 		$db->loadModule('Manager');
    63 		$db->loadModule('Manager');
    63 		$db->loadModule('Extended');
    64 		$db->loadModule('Extended');
    64 
    65 
    77 			$db->query($query);
    78 			$db->query($query);
    78 		}
    79 		}
    79 
    80 
    80 		echo "done!</p>";
    81 		echo "done!</p>";
    81 
    82 
    82 		echo "<p>We have now updated the PowerDNS database to work with Poweradmin. You now want to give limited rights to Poweraadmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database. In MySQL should now perform the following command:</p>";
    83 		echo "<p>We have now updated the PowerDNS database to work with Poweradmin. You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database. ";
    83 		echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON powerdns-database.*<br>TO 'poweradmin-user'@'localhost'<br>IDENTIFIED BY 'poweradmin-password';</tt></p>";
    84 		if ($db_type=='mysql') {
    84 		echo "<p>On PgSQL you would use:</p>";
    85 			echo "In MySQL should now perform the following command:</p>";
    85 		echo "<p><tt>$ createuser poweradmin-user<br>Shall the new role be a superuser? (y/n) n<br>Shall the new user be allowed to create databases? (y/n) n<br>Shall the new user be allowed to create more new users? (y/n) n<br>CREATE USER<br>$ psql powerdns-database<br>psql> GRANT  SELECT, INSERT, DELETE, UPDATE<br>ON powerdns-database<br>TO poweradmin-user;</tt></p>";
    86 			echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON powerdns-database.*<br>TO 'poweradmin-user'@'localhost'<br>IDENTIFIED BY 'poweradmin-password';</tt></p>";
       
    87 		} elseif ($db_type == 'pgsql') {
       
    88 			echo "<p>On PgSQL you would use:</p>";
       
    89 			echo "<p><tt>$ createuser poweradmin-user<br>Shall the new role be a superuser? (y/n) n<br>Shall the new user be allowed to create databases? (y/n) n<br>Shall the new user be allowed to create more new users? (y/n) n<br>CREATE USER<br>$ psql powerdns-database<br>psql> GRANT  SELECT, INSERT, DELETE, UPDATE<br>ON powerdns-database<br>TO poweradmin-user;</tt></p>";
       
    90 		}
    86 		echo "<p>After you have added the new user, proceed with this installation procedure.</p>\n";
    91 		echo "<p>After you have added the new user, proceed with this installation procedure.</p>\n";
    87 		echo "<form method=\"post\">";
    92 		echo "<form method=\"post\">";
    88 		echo "<input type=\"hidden\" name=\"host\" value=\"" . $db_host . "\">";
    93 		echo "<input type=\"hidden\" name=\"host\" value=\"" . $db_host . "\">";
    89 		echo "<input type=\"hidden\" name=\"name\" value=\"" . $db_name . "\">";
    94 		echo "<input type=\"hidden\" name=\"name\" value=\"" . $db_name . "\">";
    90 		echo "<input type=\"hidden\" name=\"type\" value=\"" . $db_type . "\">";
    95 		echo "<input type=\"hidden\" name=\"type\" value=\"" . $db_type . "\">";