<?php
session_start();
//Include system variables
include("includes/variables.php");
include("config.php");
//Include used classes
include("classes/opendb.class.php");
$database_connection = new database_connection();
if(isset($_GET['install'])){
if($_GET['install'] == "created_db"){
$database_connection->dataquery("CREATE TABLE IF NOT EXISTS `tblUser` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(100) NOT NULL,`password` varchar(100) NOT NULL,`email` varchar(100) NOT NULL,`authority` int(2) NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;");
}
elseif($_GET['install'] == "created_admin"){
$database_connection->dataquery("INSERT INTO `tblUser` (`username`, `password`, `authority`) VALUES ('".$_POST['username']."', '".$_POST['password']."', 10);");
echo $database_connection->error_message;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>qAdmin - install</title>
<link href="main.css" rel="stylesheet" type="text/css" />
<script src="includes/cufon-yui.js" type="text/javascript"></script>
<script src="includes/TheMixBold_400.font.js" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('h1');
</script>
</head>
<body>
<div class="admin">
<h1>qAdmin</h1>
<div class="loginform">
<?php
if(!isset($_GET['install'])){
echo '<a href="?install=created_db">Install into: '. $database . '</a>';
}
elseif($_GET['install'] == "created_db")
{
?>
<form action="install.php?install=created_admin" method="post">
<input type="text" name="username" id="username" placeholder="Username"/><br/>
<input type="text" name="password" id="password" placeholder="Password" /><br />
<input type="submit" name="createlogin" id="createlogin" value="Create Login" />
</form>
<?php
}
elseif($_GET['install'] == "created_admin")
{
?>
<a href="index.php">Login to admin panel</a>
<?php
}
?>
</div>
</div>
</body>
</html>