body { font-family: Courier; }";
if (!file_exists("./install.lock")) {
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME);
echo "
Blessing Skin Server Install
";
if ($conn->connect_error) {
utils::raise(-1, "Can not connect to mysql, check if database info correct in config.php. ".$conn->connect_error);
} else {
echo "Succesfully connected to database ".DB_USER."@".DB_HOST.".
";
}
echo "Start creating tables...
";
$sql = "CREATE TABLE IF NOT EXISTS `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`password` varchar(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`preference` varchar(10) NOT NULL,
`skin_hash` varchar(64) NOT NULL,
`cape_hash` varchar(64) NOT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;";
if(!$conn->query($sql)) {
utils::raise(1, "Creating tables failed. ".$conn->error);
}
/**
* username: admin
* password: 123456
*/
$conn->query("INSERT INTO `users` (`uid`, `username`, `password`, `ip`, `preference`) VALUES(1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '127.0.0.1', 'default')");
echo "Creating tables successfully
";
echo "
+-----------------------------------------------------------------------------------+
| uid | username | password | ip | preference | skin_hash | cape_hash |
+-----------------------------------------------------------------------------------+
| 1 | admin | 123456 | * | default | * | * |
+-----------------------------------------------------------------------------------+
";
echo "Successfully installed. Index";
if ($lock = fopen("./install.lock", 'w')) {
fwrite($lock, time());
fclose($lock);
} else {
die("Unable to write `install.lock`. Please check the permisson and create a `install.lock` file manually.");
}
} else {
echo "
";
echo "It seems that you have already installed. Index
";
echo "May you should delete the file `install.lock` in ./admin to unlock installing.";
}
?>