diff --git a/admin/install.php b/admin/install.php index b1d5d794..6788a41d 100644 --- a/admin/install.php +++ b/admin/install.php @@ -1,4 +1,18 @@ Blessing Skin Server Install"; if (!$con) { - die ("Can not connect to mysql, check if database info correct in config.php. ".mysql_error()); + utils::raise('1', "Can not connect to mysql, check if database info correct in config.php. ".mysql_error()) } else { echo "Succesfully connected to mysql server.

"; } if(!mysql_select_db(DB_NAME, $con)){ - die("Can not select database, please check if database '".DB_NAME."' really exists."); + utils::raise('1', "Can not select database, please check if database '".DB_NAME."' really exists.") } echo "Selected database: ".DB_NAME."

"; @@ -21,10 +35,12 @@ if (!file_exists("./install.lock")) { $query = "CREATE TABLE IF NOT EXISTS `users` ( `uid` int(11) NOT NULL AUTO_INCREMENT, - `admin` tinyint(1) NOT NULL DEFAULT '0', `username` varchar(20) NOT NULL, `password` varchar(32) NOT NULL, `ip` varchar(32) NOT NULL, + `preference` varchar(32) NOT NULL, + `skin_hash` varchar(32) NOT NULL, + `cape_hash` varchar(32) NOT NULL, PRIMARY KEY (`uid`), UNIQUE KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;"; @@ -37,16 +53,20 @@ if (!file_exists("./install.lock")) { * username: admin * password: 123456 */ - mysql_query("INSERT INTO `users` (`uid`, `admin`, `username`, `password`, `ip`) VALUES(1, 1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '')"); + mysql_query("INSERT INTO `users` (`uid`, `username`, `password`, `ip`) VALUES(1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '127.0.0.1')"); echo "Successfully installed. Index"; - $lock = fopen("./install.lock", w) or die("Unable to write 'install.lock'."); - fwrite($lock, time()); - fclose($lock); + if ($lock = fopen("./install.lock", w)) { + fwrite($lock, time()); + fclose($lock); + } else { + die("Unable to write 'install.lock'."); + } + } else { echo "It seems that you have already installed. Index

"; - echo "May you should delete the file 'install.lock' in /admin to unlock installing."; + echo "May you should delete the file 'install.lock' in ./admin to unlock installing."; } ?>