summaryrefslogtreecommitdiffstats
path: root/install.php
blob: 5b0fa3aa9eafb45deb69fc8a61c70189c9aa5730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php define("SITE_ROOT", dirname(__FILE__)); ?>

<!DOCTYPE html>
<html>

<?php include(SITE_ROOT . "/templates/" . "head.tpl.php"); ?>

<body>

<div id="wrapper">
<h1>Database Setup</h1>

<?php

	$host = $_POST["host"];
	$rpassword = $_POST["rpassword"];
	$name = $_POST["name"];
	$user = $_POST["user"];
	$password = $_POST["password"];

	require_once(SITE_ROOT . "/models/" . "database.php");
	$database = new Database();
	$db = $database->connect();

	if ($db == 0) {
		echo "Installation already done!";
	} else {
		echo "<form action='install.php' method='post'>";
		echo "Database host:<br /><input type='text' name='host' value='$host' /><br /><br />";
		echo "Database root password:<br /><input type='text' name='rpassword' value='$rpassword' /><br /><br />";
		echo "Database name:<br /><input type='text' name='name' value='$name' /><br /><br />";
		echo "Database user:<br /><input type='text' name='user' value='$user' /><br /><br />";
		echo "Database password:<br /><input type='text' name='password' value='$password' /><br /><br />";
		echo "<input type='submit' value='Install' />";
		echo "</form>";
	}
?>

</div>

</body>
</html>