added great friendly awesome install page
This commit is contained in:
parent
dc51f46c49
commit
d6f87e129e
@ -3,82 +3,181 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-16 23:01:33
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-03-12 16:44:47
|
||||
* @Last Modified time: 2016-03-12 21:03:32
|
||||
*
|
||||
* Create tables automatically
|
||||
* Blessing Skin Server Installer
|
||||
*/
|
||||
|
||||
// Sanity check
|
||||
if (false): ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<title>出现错误 - Blessing Skin Server 安装程序</title>
|
||||
<link rel="stylesheet" type="text/css" href="../assets/css/install.style.css">
|
||||
</head>
|
||||
<body class="container">
|
||||
<p id="logo"><a href="https://github.com/printempw/blessing-skin-server" tabindex="-1">Blessing Skin Server</a></p>
|
||||
<h1>错误:PHP 未运行</h1>
|
||||
<p>Blessing Skin Server 基于 PHP 开发,需要 PHP 运行环境。如果你看到这段话就说明主机的 PHP 未运行。</p>
|
||||
<p>你问 PHP 是什么?为什么不问问神奇海螺呢?</p>
|
||||
</body>
|
||||
</html>
|
||||
<?php endif;
|
||||
|
||||
$dir = dirname(dirname(__FILE__));
|
||||
require "$dir/includes/autoload.inc.php";
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
echo "<style>body { font-family: Courier, 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif; }</style>";
|
||||
|
||||
if (!file_exists("./install.lock")) {
|
||||
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
|
||||
|
||||
echo "<h2>Blessing Skin Server 安装程序</h2>";
|
||||
|
||||
if ($conn->connect_error) {
|
||||
Utils::raise(-1, "无法连接至 MySQL 服务器,确定你在 config.php 填写的数据库信息正确吗?".$conn->connect_error);
|
||||
} else {
|
||||
echo "成功连接至 MySQL 服务器 ".DB_USER."@".DB_HOST."。 <br /><br />";
|
||||
}
|
||||
|
||||
echo "开始创建数据表。。 <br /><br />";
|
||||
|
||||
$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,
|
||||
`hash_steve` varchar(64) NOT NULL,
|
||||
`hash_alex` varchar(64) NOT NULL,
|
||||
`hash_cape` varchar(64) NOT NULL,
|
||||
`last_modified` datetime NOT NULL,
|
||||
PRIMARY KEY (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;";
|
||||
|
||||
if(!$conn->query($sql)) {
|
||||
die("数据表创建失败了。。请带上错误信息联系作者 <br /><br />".$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 "数据表创建成功! <br /><br />";
|
||||
|
||||
echo "
|
||||
<pre style='font-family: Courier;'>
|
||||
+-------------------------------------------------------------------------------------------------+-----------------+
|
||||
| uid | username | password | ip | preference | hash_steve | hash_alex | hash_cape | last_modofied |
|
||||
+-------------------------------------------------------------------------------------------------+-----------------+
|
||||
| 1 | admin | 123456 | * | default | * | * | * | * |
|
||||
+-------------------------------------------------------------------------------------------------+-----------------+
|
||||
</pre>
|
||||
";
|
||||
|
||||
if (!is_dir("../textures/")) {
|
||||
echo mkdir("../textures/") ? "正在创建 textures 文件夹。。<br /><br />" :
|
||||
"文件夹创建失败。确定你的目录权限正确吗?<br /><br />";
|
||||
}
|
||||
|
||||
echo "安装成功辣~ <a href='../index.php'>首页</a>";
|
||||
|
||||
if ($lock = fopen("./install.lock", 'w')) {
|
||||
fwrite($lock, time());
|
||||
fclose($lock);
|
||||
} else {
|
||||
die("无法创建自动 `install.lock`。请人工新建一个 `install.lock` 置于 `admin` 目录下。");
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "<br />";
|
||||
echo "看起来你已经安装过一次了哦? <a href='../index.php'>首页</a><br /><br />";
|
||||
echo "或许你需要删除 `admin` 文件夹下的 `install.lock` 开解锁安装程序。";
|
||||
}
|
||||
$step = isset($_GET['step']) ? $_GET['step'] : 1;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<title>Blessing Skin Server 安装程序</title>
|
||||
<link rel="stylesheet" type="text/css" href="../assets/css/install.style.css">
|
||||
</head>
|
||||
<body class="container">
|
||||
<p id="logo"><a href="https://github.com/printempw/blessing-skin-server" tabindex="-1">Blessing Skin Server</a></p>
|
||||
<?php
|
||||
|
||||
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
|
||||
|
||||
if ($conn->connect_error): ?>
|
||||
<h1>MySQL 连接错误</h1>
|
||||
<p>无法连接至 MySQL 服务器,确定你在 config.php 填写的数据库信息正确吗?</p>
|
||||
<p><?php $conn->connect_error; ?></p>
|
||||
<?php endif;
|
||||
|
||||
if (Database::checkTableExist($conn)): ?>
|
||||
<h1>已安装过</h1>
|
||||
<p>Blessing Skin Server 看起来已经安装妥当。如果想重新安装,请删除数据库中的旧数据表。</p>
|
||||
<?php die();
|
||||
endif;
|
||||
|
||||
/*
|
||||
* Stepped installation
|
||||
*/
|
||||
switch ($step) {
|
||||
// Step 1
|
||||
case 1: ?>
|
||||
<h1>欢迎</h1>
|
||||
<p>欢迎使用 Blessing Skin Server V2!</p>
|
||||
<p>成功连接至 MySQL 服务器 <?php echo DB_USER."@".DB_HOST; ?>,点击下一步以开始安装。</p>
|
||||
<p class="step"><a href="install.php?step=2" class="button button-large">下一步</a></p>
|
||||
<?php break;
|
||||
|
||||
// Step 2
|
||||
case 2: ?>
|
||||
<h1>填写信息</h1>
|
||||
<p>您需要填写一些基本信息。无需担心填错,这些信息以后可以再次修改。</p>
|
||||
<form id="setup" method="post" action="install.php?step=3" novalidate="novalidate">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><label for="username">管理员用户名</label></th>
|
||||
<td>
|
||||
<input name="username" type="text" id="username" size="25" value="" />
|
||||
<p>用户名只能含有数字、字母、下划线。这是唯一的管理员账号。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row">
|
||||
<label for="password">密码</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="password" name="password" id="password" class="regular-text" autocomplete="off" />
|
||||
<p>
|
||||
<span class="description important">
|
||||
<b>重要:</b>您将需要此密码来登录管理皮肤站,请将其保存在安全的位置。
|
||||
</span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row">
|
||||
<label for="password2">重复密码(必填)</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="password" name="password2" id="password2" autocomplete="off" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if (isset($_GET['msg'])) echo "<div class='alert alert-warning' role='alert'>".$_GET['msg']."</div>"; ?>
|
||||
<p class="step"><input type="submit" name="Submit" id="submit" class="button button-large" value="开始安装" /></p>
|
||||
</form>
|
||||
<?php break;
|
||||
|
||||
// Step 3
|
||||
case 3:
|
||||
// check post
|
||||
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['password2'])) {
|
||||
if ($_POST['password'] != $_POST['password2']) {
|
||||
header('Location: install.php?step=2&msg=确认密码不一致。'); die();
|
||||
}
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
if (User::checkValidUname($username)) {
|
||||
if (strlen($password) > 16 || strlen($password) < 5) {
|
||||
header('Location: install.php?step=2&msg=无效的密码。密码长度应该大于 6 并小于 15。');
|
||||
die();
|
||||
} else if (Utils::convertString($password) != $password) {
|
||||
header('Location: install.php?step=2&msg=无效的密码。密码中包含了奇怪的字符。'); die();
|
||||
}
|
||||
} else {
|
||||
header('Location: install.php?step=2&msg=无效的用户名。用户名只能包含数字,字母以及下划线。'); die();
|
||||
}
|
||||
} else {
|
||||
header('Location: install.php?step=2&msg=表单信息不完整。'); die();
|
||||
}
|
||||
|
||||
$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,
|
||||
`hash_steve` varchar(64),
|
||||
`hash_alex` varchar(64),
|
||||
`hash_cape` varchar(64),
|
||||
`last_modified` datetime,
|
||||
PRIMARY KEY (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;";
|
||||
|
||||
if (!$conn->query($sql)) { ?>
|
||||
<h1>数据表创建失败</h1>
|
||||
<p>照理来说不应该的,请带上错误信息联系作者:</p>
|
||||
<p><?php echo $conn->error; ?></p>
|
||||
<?php die();
|
||||
}
|
||||
|
||||
// Insert user
|
||||
$conn->query("INSERT INTO `users` (`uid`, `username`, `password`, `ip`, `preference`) VALUES
|
||||
(1, '".$username."', '".md5($_POST['password'])."', '127.0.0.1', 'default')");
|
||||
|
||||
if (!is_dir("../textures/")) {
|
||||
if (!mkdir("../textures/")): ?>
|
||||
<h1>文件夹创建失败</h1>
|
||||
<p>textures 文件夹创建失败。确定你拥有该目录的写权限吗?</p>
|
||||
<?php endif;
|
||||
} ?>
|
||||
|
||||
<h1>成功!</h1>
|
||||
<p>Blessing Skin Server 安装完成。您是否还沉浸在愉悦的安装过程中?很遗憾,一切皆已完成! :)</p>
|
||||
<table class="form-table install-success">
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<td><?php echo $username; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>密码</th>
|
||||
<td><p><em><?php echo $password; ?></em></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="step"><a href="../index.php" class="button button-large">首页</a></p>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
312
assets/css/install.style.css
Normal file
312
assets/css/install.style.css
Normal file
@ -0,0 +1,312 @@
|
||||
/*
|
||||
* @Author: printempw
|
||||
* @Date: 2016-03-12 18:54:09
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-03-12 20:43:31
|
||||
*/
|
||||
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
|
||||
@import url(https://work.prinzeugen.net/font/Minecraft.css);
|
||||
|
||||
html {
|
||||
background: #f1f1f1;
|
||||
margin: 0 20px;
|
||||
font-weight: 400;
|
||||
}
|
||||
body {
|
||||
background: #FFF none repeat scroll 0% 0%;
|
||||
color: #444;
|
||||
font-family: Ubuntu, 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif;
|
||||
margin: 140px auto 25px;
|
||||
padding: 20px 20px 10px;
|
||||
max-width: 700px;
|
||||
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.13);
|
||||
}
|
||||
h1, h2 {
|
||||
border-bottom: 1px solid #DEDEDE;
|
||||
clear: both;
|
||||
color: #666;
|
||||
font-size: 24px;
|
||||
}
|
||||
#logo a, p, h1, h2 {
|
||||
font-weight: 400;
|
||||
}
|
||||
#logo, h1, h2 {
|
||||
padding: 0px 0px 7px;
|
||||
}
|
||||
p {
|
||||
padding-bottom: 2px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
#logo a {
|
||||
font-family: Minecraft, sans-serif;
|
||||
font-size: 50px;
|
||||
color: #666;
|
||||
height: 84px;
|
||||
line-height: 1.3em;
|
||||
margin: -130px auto 25px;
|
||||
padding: 0;
|
||||
outline: 0;
|
||||
text-decoration: none;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
/* Mobile phone */
|
||||
@media (max-width: 48em) {
|
||||
#logo a {
|
||||
font-size: 40px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 35.5em) {
|
||||
#logo a {
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
#logo {
|
||||
margin: 6px 0 14px;
|
||||
border-bottom: none;
|
||||
text-align: center;
|
||||
}
|
||||
.step {
|
||||
margin: 20px 0 15px;
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
}
|
||||
.step>input {
|
||||
font-family: Ubuntu, 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif;
|
||||
}
|
||||
fieldset {
|
||||
padding: 0;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.step {
|
||||
margin: 20px 0 15px
|
||||
}
|
||||
|
||||
.step,th {
|
||||
text-align: left;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.language-chooser.wp-core-ui .step .button.button-large {
|
||||
height: 36px;
|
||||
vertical-align: middle;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
.form-table td,.form-table th {
|
||||
padding: 10px 20px 10px 0;
|
||||
vertical-align: top;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
textarea {
|
||||
border: 1px solid #dfdfdf;
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
.form-table {
|
||||
border-collapse: collapse;
|
||||
margin-top: 1em;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
margin-bottom: 9px
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
text-align: left;
|
||||
width: 140px
|
||||
}
|
||||
|
||||
.form-table code {
|
||||
line-height: 18px;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
.form-table p {
|
||||
margin: 4px 0 0;
|
||||
font-size: 11px
|
||||
}
|
||||
|
||||
.form-table input {
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
padding: 3px 5px;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.07)
|
||||
}
|
||||
|
||||
.form-table input[type=email],.form-table input[type=password],.form-table input[type=text],.form-table input[type=url] {
|
||||
width: 206px
|
||||
}
|
||||
|
||||
.form-table.install-success td,.form-table.install-success th {
|
||||
vertical-align: middle;
|
||||
padding: 16px 20px 16px 0
|
||||
}
|
||||
|
||||
.form-table.install-success td p {
|
||||
margin: 0;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
.form-table.install-success td code {
|
||||
margin: 0;
|
||||
font-size: 18px
|
||||
}
|
||||
.container .button,.container .button-primary,.container .button-secondary {
|
||||
display:inline-block;
|
||||
text-decoration:none;
|
||||
font-size:13px;
|
||||
line-height:26px;
|
||||
height:28px;
|
||||
margin:0;
|
||||
padding:0 10px 1px;
|
||||
cursor:pointer;
|
||||
border-width:1px;
|
||||
border-style:solid;
|
||||
-webkit-appearance:none;
|
||||
-webkit-border-radius:3px;
|
||||
border-radius:3px;
|
||||
white-space:nowrap;
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box
|
||||
}
|
||||
.container button::-moz-focus-inner,.container input[type=reset]::-moz-focus-inner,.container input[type=button]::-moz-focus-inner,.container input[type=submit]::-moz-focus-inner {
|
||||
border-width:0;
|
||||
border-style:none;
|
||||
padding:0
|
||||
}
|
||||
.container .button-group.button-large .button,.container .button.button-large {
|
||||
height:30px;
|
||||
line-height:28px;
|
||||
padding:0 12px 2px
|
||||
}
|
||||
.container .button-group.button-small .button,.container .button.button-small {
|
||||
height:24px;
|
||||
line-height:22px;
|
||||
padding:0 8px 1px;
|
||||
font-size:11px
|
||||
}
|
||||
.container .button-group.button-hero .button,.container .button.button-hero {
|
||||
font-size:14px;
|
||||
height:46px;
|
||||
line-height:44px;
|
||||
padding:0 36px
|
||||
}
|
||||
.container .button:active,.container .button:focus {
|
||||
outline:0
|
||||
}
|
||||
.container .button.hidden {
|
||||
display:none
|
||||
}
|
||||
.container input[type=reset],.container input[type=reset]:active,.container input[type=reset]:focus,.container input[type=reset]:hover {
|
||||
background:0 0;
|
||||
border:none;
|
||||
-webkit-box-shadow:none;
|
||||
box-shadow:none;
|
||||
padding:0 2px 1px;
|
||||
width:auto
|
||||
}
|
||||
.container .button,.container .button-secondary {
|
||||
color:#555;
|
||||
border-color:#ccc;
|
||||
background:#f7f7f7;
|
||||
-webkit-box-shadow:0 1px 0 #ccc;
|
||||
box-shadow:0 1px 0 #ccc;
|
||||
vertical-align:top
|
||||
}
|
||||
.container p .button {
|
||||
vertical-align:baseline
|
||||
}
|
||||
.container .button-secondary:focus,.container .button-secondary:hover,.container .button.focus,.container .button.hover,.container .button:focus,.container .button:hover {
|
||||
background:#fafafa;
|
||||
border-color:#999;
|
||||
color:#23282d
|
||||
}
|
||||
.container .button-link:focus,.container .button-secondary:focus,.container .button.focus,.container .button:focus {
|
||||
border-color:#5b9dd9;
|
||||
-webkit-box-shadow:0 0 3px rgba(0,115,170,.8);
|
||||
box-shadow:0 0 3px rgba(0,115,170,.8)
|
||||
}
|
||||
.container .button-secondary:active,.container .button.active,.container .button.active:hover,.container .button:active {
|
||||
background:#eee;
|
||||
border-color:#999;
|
||||
-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);
|
||||
box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);
|
||||
-webkit-transform:translateY(1px);
|
||||
-ms-transform:translateY(1px);
|
||||
transform:translateY(1px)
|
||||
}
|
||||
.container .button.active:focus {
|
||||
border-color:#5b9dd9;
|
||||
-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5),0 0 3px rgba(0,115,170,.8);
|
||||
box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5),0 0 3px rgba(0,115,170,.8)
|
||||
}
|
||||
.container .button-disabled,.container .button-secondary.disabled,.container .button-secondary:disabled,.container .button-secondary[disabled],.container .button.disabled,.container .button:disabled,.container .button[disabled] {
|
||||
color:#a0a5aa!important;
|
||||
border-color:#ddd!important;
|
||||
background:#f7f7f7!important;
|
||||
-webkit-box-shadow:none!important;
|
||||
box-shadow:none!important;
|
||||
text-shadow:0 1px 0 #fff!important;
|
||||
cursor:default;
|
||||
-webkit-transform:none!important;
|
||||
-ms-transform:none!important;
|
||||
transform:none!important
|
||||
}
|
||||
.container .button-link {
|
||||
margin:0;
|
||||
padding:0;
|
||||
-webkit-box-shadow:none;
|
||||
box-shadow:none;
|
||||
border:0;
|
||||
-webkit-border-radius:0;
|
||||
border-radius:0;
|
||||
background:0 0;
|
||||
outline:0;
|
||||
cursor:pointer
|
||||
}
|
||||
.container .button-primary {
|
||||
background:#0085ba;
|
||||
border-color:#0073aa #006799 #006799;
|
||||
-webkit-box-shadow:0 1px 0 #006799;
|
||||
box-shadow:0 1px 0 #006799;
|
||||
color:#fff;
|
||||
text-decoration:none;
|
||||
text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799
|
||||
}
|
||||
.container .button-primary.focus,.container .button-primary.hover,.container .button-primary:focus,.container .button-primary:hover {
|
||||
background:#008ec2;
|
||||
border-color:#006799;
|
||||
color:#fff
|
||||
}
|
||||
.container .button-primary.focus,.container .button-primary:focus {
|
||||
-webkit-box-shadow:0 1px 0 #0073aa,0 0 2px 1px #33b3db;
|
||||
box-shadow:0 1px 0 #0073aa,0 0 2px 1px #33b3db
|
||||
}
|
||||
.alert {
|
||||
padding: 15px;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.alert-warning {
|
||||
color: #8a6d3b;
|
||||
background-color: #fcf8e3;
|
||||
border-color: #faebcc;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-02-02 21:59:06
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-03-12 18:42:21
|
||||
* @Last Modified time: 2016-03-12 20:55:08
|
||||
*/
|
||||
|
||||
class Database
|
||||
@ -18,17 +18,15 @@ class Database
|
||||
if (!DEBUG_MODE) error_reporting(0);
|
||||
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
|
||||
if ($conn->connect_error) {
|
||||
Utils::showErrorPage(-1, "Can not connect to mysql, check if database info correct in config.php. ".
|
||||
$conn->connect_error);
|
||||
Utils::showErrorPage($conn->connect_errno,
|
||||
"无法连接至 MySQL 服务器。请确认 config.php 中的配置是否正确:".$conn->connect_error);
|
||||
}
|
||||
if (!self::checkTableExist($conn)) {
|
||||
Utils::showErrorPage(-1, "Looks like that there is no `users` table in your database. ".
|
||||
"Please run `/admin/install.php` first.");
|
||||
Utils::showErrorPage(-1, "数据库中不存在 users 表。请先运行 /admin/install.php 进行安装。");
|
||||
}
|
||||
$dir = dirname(dirname(__FILE__));
|
||||
if (!is_dir("$dir/textures/")) {
|
||||
Utils::showErrorPage(-1, "No `textures` directory exists. Please run `/admin/install.php` ".
|
||||
"or put one manually.");
|
||||
Utils::showErrorPage(-1, "textures 文件夹不存在。请先运行 /admin/install.php 进行安装,或者手动放置一个。");
|
||||
}
|
||||
return $conn;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user