summaryrefslogtreecommitdiffstats
path: root/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'install.php')
-rw-r--r--install.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/install.php b/install.php
new file mode 100644
index 0000000..5b0fa3a
--- /dev/null
+++ b/install.php
@@ -0,0 +1,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>