Great! fully Chinese supported

This commit is contained in:
printempw 2016-02-05 22:08:06 +08:00
parent 00dde9b6ac
commit 9a5e3c91b3
18 changed files with 320 additions and 209 deletions

View File

@ -1,6 +1,6 @@
# Blessing Skin Server
Just a simple open-source Minecraft skin server write in PHP. [Live demo](https://work.prinzeugen.net/blessing-skin-server/)
优雅的开源 PHP Minecraft 皮肤站。[Live demo](https://work.prinzeugen.net/blessing-skin-server/)
![screenshot](https://img.prinzeugen.net/image.php?di=FIQD)

109
README_en-US.md Normal file
View File

@ -0,0 +1,109 @@
# Blessing Skin Server
Just a simple open-source Minecraft skin server write in PHP. [Live demo](https://work.prinzeugen.net/blessing-skin-server/)
![screenshot](https://img.prinzeugen.net/image.php?di=FIQD)
Features:
-----------
- Support latest [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/blob/master/doc/UniSkinAPI_zh-CN.md)
- Support CustomSkinLoader API
- Also support legacy link to access image directly
- Nothing else...
Installation:
-----------
1. Configure your database information in config.php
2. Run `./admin/install.php`
3. Configure your rewrite rules in your `nginx.conf`
3. Register or login with `admin/123456`
4. Upload your skin/cape
5. Configure your url in `UniSkinMod.cfg` of Minecraft client
6. Enjoy~
Server configure:
------------
Add rewrite rules to your nginx.conf:
```
rewrite ^/([^/]*).json$ /get.php?type=json&uname=$1 last;
rewrite ^/(skin|cape)/([^/-]*)(|-)(|alex|steve).png$ /get.php?type=$1&model=$4&uname=$2 last;
# Optional
rewrite ^/(usm|csl)/([^/]*).json$ /get.php?type=json&uname=$2&api=$1 last;
rewrite ^/(usm|csl)/textures/(.*)$ /textures/$2 last;
```
You can also use optional rewrite rules to support both CustomSkinLoader API & UniSkinAPI.
If you installed the skin server to subdirectory, you should configure the rules as this:
```
rewrite ^/subdir/([^/]*).json$ /subdir/get.php?type=json&uname=$1 last;
```
Now you can access `http://example.com/username.json` to get your json profile of your preferred API. Another API is also available `http://example.com/(usm|csl)/username.json`.
After uploading skins, you can also access `http://example.com/skin/username.png` for prefered model's skin image or `http://example.com/cape/username.png` for cape. Secondary model's texture is available on `http://example.com/skin/username-(alex|steve).png`.
Client configure:
------------
#### For UniSkinMod version >= 1.3
Put your root directory of skin server( like `/path/to/root` above ) into your `/config/UniSkinMod.cfg` of Minecraft client
Sample:
```
# Line starts with '#' is a commit line
# Line starts with 'Root: ' indicates a server
# All servers will be queried in that order.
# Server in front has higher priority
# Official server has the lowest priority
# No more legacy style link support!
# SkinMe Default
Root: http://www.skinme.cc/uniskin
# Your Server
Root: http://example.com
```
#### For UniSkinMod version < 1.3 or other
Also put your url into `/config/UniSkinMod.cfg`, but you need to fill 2 urls for skin and cape
Sample:
```
Version: 1
# Do not edit the line above
Skin: http://skins.minecraft.net/MinecraftSkins/%s.png
Cape: http://skins.minecraft.net/MinecraftCloaks/%s.png
# Your Server
Skin: http://example.com/skin/%s.png
Cape: http://example.com/cape/%s.png
```
FAQ
------------
If everything works well, you will get an awesome skin in game:
![screenshot2](https://img.prinzeugen.net/image.php?di=EV1E)
And the log will be like this:
```
[16:23:56] [launcher/INFO] [UniSkinMod]: Loading configuration ... @D:\Minecraft\1.8\.minecraft\config\UniSkinMod.cfg
[16:23:56] [launcher/INFO] [UniSkinMod]: Root Url Added: http://127.0.0.1/blessing-skin-server
[16:24:23] [Client thread/INFO] [UniSkinMod]: Filling profile for player: 621sama
[16:24:23] [Client thread/INFO] [UniSkinMod]: Fetching URL: http://127.0.0.1/blessing-skin-server/621sama.json
[16:24:23] [Client thread/INFO] [UniSkinMod]: Player Skin Selected: 621sama default 3f14a21723023642b9e8d2bc008b443780698aaedbb7d4e29960e8a2c754a771
[16:24:23] [Client thread/INFO] [UniSkinMod]: Player Cape Selected: 621sama aed8c3fc67aae4906b72fa74c27e15866c89752f0838f6b2a1c44bb4d59cec1e
```
If not, please check your log to locate where error occured.

View File

@ -3,7 +3,7 @@
* @Author: prpr
* @Date: 2016-02-04 13:53:55
* @Last Modified by: prpr
* @Last Modified time: 2016-02-04 18:42:22
* @Last Modified time: 2016-02-05 21:43:29
*/
session_start();
$dir = dirname(dirname(__FILE__));
@ -20,12 +20,12 @@ if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
if (isset($_SESSION['uname'])) {
$admin = new user($_SESSION['uname']);
if ($_SESSION['token'] != $admin->getToken()) {
header('Location: ../index.php?msg=Invalid token. Please login.');
header('Location: ../index.php?msg=无效的 token请重新登录。');
} else if (!$admin->is_admin) {
header('Location: ../index.php?msg=Looks like that you are not administrator :(');
header('Location: ../index.php?msg=看起来你并不是管理员');
}
} else {
header('Location: ../index.php?msg=Illegal access. Please login.');
header('Location: ../index.php?msg=非法访问,请先登录。');
}
/*
@ -42,34 +42,34 @@ if (isset($_GET['action'])) {
if (!is_null($file)) {
if ($user->setTexture($type, $file)) {
$json['errno'] = 0;
$json['msg'] = "Skin uploaded successfully.";
$json['msg'] = "皮肤上传成功。";
} else {
$json['errno'] = 1;
$json['msg'] = "Uncaught error.";
$json['msg'] = "出现了奇怪的错误。。请联系作者";
}
} else {
utils::raise(1, 'No input file selected');
utils::raise(1, '你没有选择任何文件哦');
}
} else if ($action == "change") {
if (user::checkValidPwd($_POST['passwd'])) {
$user->changePasswd($_POST['passwd']);
$json['errno'] = 0;
$json['msg'] = "Password of ".$_GET['uname']." changed successfully.";
$json['msg'] = "成功更改了 ".$_GET['uname']." 的密码。";
} // Will raise exception if password invalid
} else if ($action == "delete") {
$user->unRegister();
$json['errno'] = 0;
$json['msg'] = "Account successfully deleted.";
$json['msg'] = "成功删除了该用户。";
} else if ($action == "model") {
if (isset($_POST['model']) && $_POST['model'] == 'slim' || $_POST['model'] == 'default') {
$user->setPreference($_POST['model']);
$json['errno'] = 0;
$json['msg'] = "Model preference of ".$_GET['uname']." changed to ".$_POST['model']." successfully.";
$json['msg'] = "成功地将用户 ".$_GET['uname']." 的优先皮肤模型更改为 ".$_POST['model']." ";
} else {
utils::raise(1, 'Illegal parameters');
utils::raise(1, '非法参数。');
}
} else {
utils::raise(1, 'Illegal parameters');
utils::raise(1, '非法参数。');
}
}

View File

@ -3,7 +3,7 @@
* @Author: prpr
* @Date: 2016-02-03 14:39:50
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 16:05:42
* @Last Modified time: 2016-02-05 21:44:08
*/
session_start();
@ -18,12 +18,12 @@ if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
if (isset($_SESSION['uname'])) {
$admin = new user($_SESSION['uname']);
if ($_SESSION['token'] != $admin->getToken()) {
header('Location: ../index.php?msg=Invalid token. Please login.');
header('Location: ../index.php?msg=无效的 token请重新登录。');
} else if (!$admin->is_admin) {
header('Location: ../index.php?msg=Looks like that you are not administrator :(');
header('Location: ../index.php?msg=看起来你并不是管理员');
}
} else {
header('Location: ../index.php?msg=Illegal access. Please login.');
header('Location: ../index.php?msg=非法访问,请先登录。');
}
?>
@ -32,7 +32,7 @@ if (isset($_SESSION['uname'])) {
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Console - <?php echo SITE_TITLE; ?></title>
<title>仪表盘 - <?php echo SITE_TITLE; ?></title>
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="stylesheet" href="../libs/pure/pure-min.css">
<link rel="stylesheet" href="../libs/pure/grids-responsive-min.css">
@ -48,10 +48,10 @@ if (isset($_SESSION['uname'])) {
<a class="pure-menu-heading" href="../index.php"><?php echo SITE_TITLE; ?></a>
<ul class="pure-menu-list">
<li class="pure-menu-item">
<a class="pure-menu-link" href="../user/profile.php">Profile</a>
<a class="pure-menu-link" href="../user/profile.php">个人设置</a>
</li>
<li class="pure-menu-item">
<span class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</span> | <span class="pure-menu-link" id="logout">Log out?</span>
<span class="pure-menu-link">欢迎, <?php echo $_SESSION['uname']; ?></span> | <span class="pure-menu-link" id="logout">登出?</span>
</li>
</ul>
<div class="home-menu-blur">
@ -67,10 +67,10 @@ if (isset($_SESSION['uname'])) {
<thead>
<tr>
<th>#</th>
<th>Username</th>
<th>Preview Textures</th>
<th>Change Textures</th>
<th>Opreation</th>
<th>用户名</th>
<th>预览材质</th>
<th>更改材质</th>
<th>操作</th>
</tr>
</thead>
@ -88,14 +88,14 @@ if (isset($_SESSION['uname'])) {
<?php echo '<img id="'.$row['username'].'_cape" width="64" '.(($row['hash_cape'] == "") ? '' : 'src="../cape/'.$row['username'].'.png"').'/>'; ?>
</td>
<td>
<a href="javascript:uploadSkin('<?php echo $row['username']; ?>');" class="pure-button pure-button-primary">Skin</a>
<a href="javascript:uploadTexture('<?php echo $row['username']; ?>', 'cape');" class="pure-button pure-button-primary">Cape</a>
<a href="javascript:changeModel('<?php echo $row['username']; ?>');" class="pure-button pure-button-default">Model</a>
<a href="javascript:uploadSkin('<?php echo $row['username']; ?>');" class="pure-button pure-button-primary">皮肤</a>
<a href="javascript:uploadTexture('<?php echo $row['username']; ?>', 'cape');" class="pure-button pure-button-primary">披风</a>
<a href="javascript:changeModel('<?php echo $row['username']; ?>');" class="pure-button pure-button-default">优先模型</a>
<span>(<?php echo $row['preference']; ?>)</span>
</td>
<td>
<a href="javascript:changePasswd('<?php echo $row['username'] ?>');" class="pure-button pure-button-default">Password</a>
<a href="javascript:deleteAccount('<?php echo $row['username'] ?>');" class="pure-button pure-button-error">Delete</a>
<a href="javascript:changePasswd('<?php echo $row['username'] ?>');" class="pure-button pure-button-default">更改密码</a>
<a href="javascript:deleteAccount('<?php echo $row['username'] ?>');" class="pure-button pure-button-error">删除用户</a>
</td>
</tr>
<?php } ?>

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 12:36:34
* @Last Modified time: 2016-02-05 21:41:55
*
* Create tables automatically
*/
@ -11,20 +11,20 @@
$dir = dirname(dirname(__FILE__));
require "$dir/includes/autoload.inc.php";
echo "<style>body { font-family: Courier; }</style>";
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);
echo "<h2>Blessing Skin Server Install</h2>";
echo "<h2>Blessing Skin Server 安装程序</h2>";
if ($conn->connect_error) {
utils::raise(-1, "Can not connect to mysql, check if database info correct in config.php. ".$conn->connect_error);
utils::raise(-1, "无法连接至 MySQL 服务器,确定你在 config.php 填写的数据库信息正确吗?".$conn->connect_error);
} else {
echo "Succesfully connected to database ".DB_USER."@".DB_HOST.". <br /><br />";
echo "成功连接至 MySQL 服务器 ".DB_USER."@".DB_HOST." <br /><br />";
}
echo "Start creating tables... <br /><br />";
echo "开始创建数据表。。 <br /><br />";
$sql = "CREATE TABLE IF NOT EXISTS `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
@ -40,7 +40,7 @@ if (!file_exists("./install.lock")) {
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15;";
if(!$conn->query($sql)) {
die("Creating tables failed. <br /><br />".$conn->error);
die("数据表创建失败了。。请带上错误信息联系作者 <br /><br />".$conn->error);
}
/**
@ -49,7 +49,7 @@ if (!file_exists("./install.lock")) {
*/
$conn->query("INSERT INTO `users` (`uid`, `username`, `password`, `ip`, `preference`) VALUES(1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '127.0.0.1', 'default')");
echo "Creating tables successfully <br /><br />";
echo "数据表创建成功! <br /><br />";
echo "
<pre style='font-family: Courier;'>
@ -62,22 +62,22 @@ if (!file_exists("./install.lock")) {
";
if (!is_dir("../textures/")) {
echo mkdir("../textures/") ? "Creating textures directory...<br /><br />" :
"Creating textures directory failed. Check permissons.<br /><br />";
echo mkdir("../textures/") ? "正在创建 textures 文件夹。。<br /><br />" :
"文件夹创建失败。确定你的目录权限正确吗?<br /><br />";
}
echo "Successfully installed. <a href='../index.php'>Index</a>";
echo "安装成功辣~ <a href='../index.php'>首页</a>";
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.");
die("无法创建自动 `install.lock`。请人工新建一个 `install.lock` 置于 `admin` 目录下。");
}
} else {
echo "<br />";
echo "It seems that you have already installed. <a href='../index.php'>Index</a><br /><br />";
echo "May you should delete the file `install.lock` in ./admin to unlock installing.";
echo "看起来你已经安装过一次了哦? <a href='../index.php'>首页</a><br /><br />";
echo "或许你需要删除 `admin` 文件夹下的 `install.lock` 开解锁安装程序。";
}
?>

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 15:35:31
* @Last Modified time: 2016-02-05 21:23:27
*
* - login, register, logout
* - upload, change, delete
@ -24,10 +24,10 @@ if (isset($_POST['uname'])) {
if (user::checkValidUname($uname)) {
$user = new user($_POST['uname']);
} else {
utils::raise(1, 'Invalid username. Only letters, numbers and _ is allowed.');
utils::raise(1, '无效的用户名。用户名只能包含数字,字母以及下划线。');
}
} else {
utils::raise('1', 'Empty username.');
utils::raise('1', '空用户名。');
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
$json = null;
@ -39,16 +39,16 @@ if ($action == "login") {
if (checkPost()) {
if (!$user->is_registered) {
$json['errno'] = 1;
$json['msg'] = "Non-existent user.";
$json['msg'] = "用户不存在哦";
} else {
if ($user->checkPasswd($_POST['passwd'])) {
$json['errno'] = 0;
$json['msg'] = 'Logging in succeed!';
$json['msg'] = '登录成功,欢迎回来~';
$json['token'] = $user->getToken();
$_SESSION['token'] = $user->getToken();
} else {
$json['errno'] = 1;
$json['msg'] = "Incorrect usename or password.";
$json['msg'] = "用户名或密码不对哦";
}
}
}
@ -69,19 +69,19 @@ if ($action == "login") {
// use once md5 to encrypt password
if ($user->register(md5($_POST['passwd']), $ip)) {
$json['errno'] = 0;
$json['msg'] = "Registered successfully.";
$json['msg'] = "注册成功~";
} else {
$json['errno'] = 1;
$json['msg'] = "Uncaught error.";
$json['msg'] = "出现了奇怪的错误。。请联系作者 :(";
}
} else {
$json['errno'] = 1;
$json['msg'] = "You can't create more than ".REGS_PER_IP." accounts with this IP.";
$json['msg'] = "你最多只能注册 ".REGS_PER_IP." 个账户哦";
}
}
} else {
$json['errno'] = 1;
$json['msg'] = "User already registered.";
$json['msg'] = "这个用户名已经被人注册辣,换一个吧";
}
}
}
@ -90,7 +90,7 @@ function checkPost() {
global $json;
if (!isset($_POST['passwd'])) {
$json['errno'] = 1;
$json['msg'] = "Empty password!";
$json['msg'] = "空密码。";
return false;
}
return true;
@ -106,35 +106,35 @@ if ($action == "upload") {
$model = (isset($_GET['model']) && $_GET['model'] == "steve") ? "steve" : "alex";
if ($user->setTexture($model, $file)) {
$json['skin']['errno'] = 0;
$json['skin']['msg'] = "Skin uploaded successfully.";
$json['skin']['msg'] = "皮肤上传成功!";
} else {
$json['skin']['errno'] = 1;
$json['skin']['msg'] = "Uncaught error.";
$json['skin']['msg'] = "出现了奇怪的错误。。请联系作者 :(";
}
}
if ($file = utils::getValue('cape_file', $_FILES)) {
if ($user->setTexture('cape', $file)) {
$json['cape']['errno'] = 0;
$json['cape']['msg'] = "Cape uploaded successfully.";
$json['cape']['msg'] = "披风上传成功!";
} else {
$json['cape']['errno'] = 1;
$json['cape']['msg'] = "Uncaught error.";
$json['cape']['msg'] = "出现了奇怪的错误。。请联系作者 :(";
}
}
}
} else {
$json['errno'] = 1;
$json['msg'] = "Invalid token.";
$json['msg'] = "无效的 token请先登录。";
}
} else if ($action == "model") {
if (utils::getValue('token', $_SESSION) == $user->getToken()) {
$new_model = ($user->getPreference() == "default") ? "slim" : "default";
$user->setPreference($new_model);
$json['errno'] = 0;
$json['msg'] = "Preferred model successfully changed to ".$user->getPreference().".";
$json['msg'] = "优先模型已经更改为 ".$user->getPreference()."";
} else {
$json['errno'] = 1;
$json['msg'] = "Invalid token.";
$json['msg'] = "无效的 token请先登录。";
}
}
@ -143,7 +143,7 @@ function checkFile() {
if (!(utils::getValue('skin_file', $_FILES) || utils::getValue('cape_file', $_FILES))) {
$json['errno'] = 1;
$json['msg'] = "No input file selected.";
$json['msg'] = "什么文件都没有诶?";
return false;
}
/**
@ -159,11 +159,11 @@ function checkFile() {
} else {
if (utils::getValue('skin_file', $_FILES)) {
$json['errno'] = 1;
$json['msg'] = 'Skin file type error.';
$json['msg'] = '错误的皮肤文件类型。';
return false;
} else {
$json['skin']['errno'] = 0;
$json['skin']['msg'] = 'No skin file selected.';
$json['skin']['msg'] = '什么文件都没有诶?';
}
}
@ -180,11 +180,11 @@ function checkFile() {
} else {
if (utils::getValue('cape_file', $_FILES)) {
$json['errno'] = 1;
$json['msg'] = 'Cape file type error.';
$json['msg'] = '错误的披风文件类型。';
return false;
} else {
$json['cape']['errno'] = 0;
$json['cape']['msg'] = 'No cape file selected.';
$json['cape']['msg'] = '什么文件都没有诶?';
}
}
@ -200,14 +200,14 @@ if ($action == "change") {
if ($user->checkPasswd($_POST['passwd'])) {
$user->changePasswd($_POST['new_passwd']);
$json['errno'] = 0;
$json['msg'] = "Password updated successfully.";
$json['msg'] = "密码更改成功。请重新登录。";
} else {
$json['errno'] = 1;
$json['msg'] = "Incorrect usename or password.";
$json['msg'] = "原密码不对哦?";
}
} else {
$json['errno'] = 1;
$json['msg'] = "New password required.";
$json['msg'] = "新密码呢?";
}
}
} else if ($action == "delete") {
@ -217,30 +217,30 @@ if ($action == "change") {
session_destroy();
$user->unRegister();
$json['errno'] = 0;
$json['msg'] = "Account successfully deleted.";
$json['msg'] = "账号已经成功删除,再见~";
} else {
$json['errno'] = 1;
$json['msg'] = "Incorrect password.";
$json['msg'] = "错误的密码。";
}
}
} else {
$json['errno'] = 1;
$json['msg'] = "Invalid token.";
$json['msg'] = "无效的 token请先登录。";
}
} else if ($action == "logout") {
if (utils::getValue('token', $_SESSION)) {
session_destroy();
$json['errno'] = 0;
$json['msg'] = 'Session destroyed.';
$json['msg'] = 'Session 成功销毁。';
} else {
$json['errno'] = 1;
$json['msg'] = 'No available session.';
$json['msg'] = '并没有任何有效的 session。';
}
}
if (!$action) {
$json['errno'] = 1;
$json['msg'] = "Invalid parameters.";
$json['msg'] = "无效的参数。不要乱 POST 玩哦。";
}
echo json_encode($json);

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-01-21 07:57:38
* @Last Modified by: prpr
* @Last Modified time: 2016-02-04 23:15:08
* @Last Modified time: 2016-02-05 21:13:54
*/
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
@ -21,7 +21,7 @@ html {
line-height: 1.7em;
color: #fff;
font-size: 13px;
font-family: Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: Ubuntu, 'Segoe UI', 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif;
}
p {
@ -164,3 +164,6 @@ p {
margin-top: 100px;
}
}
.ply-layer {
font-family: Ubuntu, 'Segoe UI', 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif!important;
}

View File

@ -2,14 +2,14 @@
* @Author: prpr
* @Date: 2016-02-04 16:48:42
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 15:52:32
* @Last Modified time: 2016-02-05 22:01:44
*/
'use strict';
function uploadSkin(uname) {
Ply.dialog("confirm", {
text: "Which model do you want to change?",
text: "更改该用户对应哪个模型的皮肤?",
ok: "Steve",
cancel: "Alex"
}).done(function(){
@ -21,9 +21,9 @@ function uploadSkin(uname) {
function uploadTexture(uname, type) {
var ply = new Ply({
el: '<h2>Upload new '+type+':</h2>'+
el: '<h2>为该用户上传新的 '+type+':</h2>'+
'<input type="file" id="file" accept="image/png">'+
'<button id="upload" class="pure-button pure-button-primary fw">Upload</button>',
'<button id="upload" class="pure-button pure-button-primary fw">上传</button>',
effect: "fade",
onaction: function(){
var form_data = new FormData();
@ -39,11 +39,11 @@ function uploadTexture(uname, type) {
processData: false,
success: function(json) {
if (json.errno == 0) {
showAlert("Successfully uploaded.", function(){
showAlert("上传成功。", function(){
location.reload();
});
} else {
showAlert("Error when uploading texture:\n" + json.msg);
showAlert("上传材质的时候出错啦:\n" + json.msg);
}
}
});
@ -56,8 +56,8 @@ function uploadTexture(uname, type) {
function changePasswd(uname) {
Ply.dialog("prompt", {
title: "Type in "+uname+"'s new password",
form: { passwd: "New Password" }
title: "修改 "+uname+" 的登录密码:",
form: { passwd: "新的密码" }
}).done(function(ui){
var passwd = ui.data.passwd;
$.ajax({
@ -78,7 +78,7 @@ function changePasswd(uname) {
function deleteAccount(uname) {
Ply.dialog("prompt", {
title: "Are you sure to delete "+uname+"?",
title: "确定要删除 "+uname+"?此操作不可恢复。",
}).done(function(ui){
$.ajax({
type: "POST",
@ -99,8 +99,8 @@ function deleteAccount(uname) {
function changeModel(uname) {
Ply.dialog("prompt", {
title: "Change "+uname+"'s model prefrence:",
form: { text: "Type in `slim` or `default`" }
title: "修改 "+uname+" 的优先皮肤模型:",
form: { text: "输入 `slim` 或者 `default`" }
}).done(function(ui){
var model = ui.data.text;
if (model == 'slim'| model == 'default') {
@ -120,7 +120,7 @@ function changeModel(uname) {
}
});
} else {
showAlert('Only `slim` or `default` is valid.');
showAlert('只能输入 `slim` 或者 `default` 哦');
}
});
}

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-01-21 13:55:44
* @Last Modified by: prpr
* @Last Modified time: 2016-02-04 12:34:37
* @Last Modified time: 2016-02-05 21:11:56
*/
'use strict';
@ -17,22 +17,22 @@ var login = function() {
dataType: "json",
data: { "uname": uname, "passwd": passwd },
beforeSend: function() {
showMsg("alert-info", "Logging in...");
showMsg('alert-info', '登录中。。');
},
success: function(json) {
if (json.errno == 0) {
docCookies.setItem("uname", uname, null, '/');
docCookies.setItem("token", json.token, null, '/');
if ($("#keep").prop("checked")) {
docCookies.setItem("uname", uname, 604800, '/');
docCookies.setItem('uname', uname, null, '/');
docCookies.setItem('token', json.token, null, '/');
if ($('#keep').prop('checked')) {
docCookies.setItem('uname', uname, 604800, '/');
// 设置长效 token 7天
docCookies.setItem("token", json.token, 604800, '/');
docCookies.setItem('token', json.token, 604800, '/');
}
showAlert("Logging succeed!");
window.setTimeout("window.location = './user/index.php'", 1000);
showAlert(json.msg);
window.setTimeout('window.location = "./user/index.php"', 1000);
} else {
showAlert(json.msg);
showMsg('hide', "");
showMsg('hide', '');
}
}
});
@ -40,25 +40,25 @@ var login = function() {
}
var register = function() {
var uname = $("#reg-uname").val();
var passwd = $("#reg-passwd").val();
if (checkForm("register", uname, passwd, $("#reg-passwd2").val())) {
var uname = $('#reg-uname').val();
var passwd = $('#reg-passwd').val();
if (checkForm('register', uname, passwd, $('#reg-passwd2').val())) {
$.ajax({
type: "POST",
url: "ajax.php?action=register",
dataType: "json",
data: {"uname":uname, "passwd":passwd},
data: {'uname':uname, 'passwd':passwd},
beforeSend: function() {
showMsg("alert-info", "Registering...");
showMsg('alert-info', 'Registering...');
},
success: function(json) {
if (json.errno == 0) {
showAlert(json.msg, function(){
showMsg('hide', "");
showMsg('hide', '');
$('[data-remodal-id=register-modal]').remodal().close();
// Automatically login after registeration
$("#uname").val(uname);
$("#passwd").val(passwd);
$('#uname').val(uname);
$('#passwd').val(passwd);
login();
});
} else {
@ -74,12 +74,12 @@ function checkForm(type, uname, passwd, passwd2) {
switch(type) {
case "login":
if (uname == "") {
showMsg("alert-warning", "Empty Username!");
showMsg('alert-warning', '用户名不能为空哦');
$("#uname").focus();
return false;
} else if (passwd == ""){
showMsg("alert-warning", "Empty Password!");
$("#passwd").focus();
showMsg('alert-warning', '密码不能为空哦');
$('#passwd').focus();
return false;
} else {
return true;
@ -87,20 +87,20 @@ function checkForm(type, uname, passwd, passwd2) {
break;
case "register":
if (uname == "") {
showMsg("alert-warning", "Empty Username!");
$("#uname").focus();
showMsg('alert-warning', '用户名不能为空哦');
$('#uname').focus();
return false;
} else if (passwd == ""){
showMsg("alert-warning", "Empty Password!");
$("#passwd").focus();
showMsg('alert-warning', '密码不能为空哦');
$('#passwd').focus();
return false;
} else if (passwd2 == ""){
showMsg("alert-warning", "Empty Confirming Password!");
$("#cpasswd").focus();
showMsg('alert-warning', '确认密码不能为空');
$('#cpasswd').focus();
return false;
} else if (passwd != passwd2){
showMsg("alert-warning", "Non-equal password confirming!");
$("#cpasswd").focus();
showMsg('alert-warning', '注册密码和确认密码不一样诶');
$('#cpasswd').focus();
return false;
} else {
return true;
@ -120,12 +120,12 @@ $('#register').click(function(){
})
// Register Event
$("body").on("keypress", "[data-remodal-id=register-modal]", function(event){
$('body').on('keypress', '[data-remodal-id=register-modal]', function(event){
if (event.which == 13) register();
}).on("click", "#register-button", register);
}).on('click', '#register-button', register);
// Login Event
$("body").on("keypress", "[data-remodal-id=login-modal]", function(event){
$('body').on('keypress', '[data-remodal-id=login-modal]', function(event){
if (event.which == 13) login();
}).on("click", "#login-button", login);
}).on('click', '#login-button', login);

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-02-03 17:21:46
* @Last Modified by: prpr
* @Last Modified time: 2016-02-03 20:25:52
* @Last Modified time: 2016-02-05 21:23:08
*/
'use strict';
@ -19,7 +19,7 @@ $('#change').click(function(){
success: function(json) {
if (json.errno == 0) {
logout(function(){
showAlert(json.msg + " Please log in again.", function(){
showAlert(json.msg, function(){
window.location = "../index.php";
});
});
@ -33,20 +33,20 @@ $('#change').click(function(){
function checkForm(passwd, new_passwd, confirm_pwd) {
if (passwd == ""){
showAlert("Empty Password!");
//$("#passwd").focus();
showAlert("原密码不能为空");
$("#passwd").focus();
return false;
} else if (new_passwd == ""){
showAlert("Empty New Password!");
showAlert("新密码要好好填哦");
$("#new_passwd").focus();
return false;
} else if (confirm_pwd == ""){
showAlert("Empty Confirming Password!");
showAlert("确认密码不能为空");
$("#confirm_pwd").focus();
return false;
} else if (new_passwd != confirm_pwd){
console.log(new_passwd, confirm_pwd)
showAlert("Non-equal password confirming!");
showAlert("新密码和确认的密码不一样诶?");
$("#confirm_pwd").focus();
return false;
} else {
@ -56,7 +56,7 @@ function checkForm(passwd, new_passwd, confirm_pwd) {
$('#delete').click(function(){
Ply.dialog("prompt", {
title: "Type in your password to confirm:",
title: "这是危险操作!输入密码来确认:",
form: { passwd: "Password" }
}).done(function(ui){
var passwd = ui.data.passwd;
@ -69,7 +69,7 @@ $('#delete').click(function(){
if (json.errno == 0) {
docCookies.removeItem("uname", "/");
docCookies.removeItem("token", "/");
showAlert(json.msg + " Bye~", function(){
showAlert(json.msg, function(){
window.location = "../index.php";
});
} else {

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-01-21 13:56:40
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 18:54:38
* @Last Modified time: 2016-02-05 21:20:30
*/
'use strict';
@ -33,13 +33,13 @@ function handleFiles(files, type) {
}
};
img.onerror = function () {
showMsg("alert-danger", "Error: Not an image or unknown file format");
showMsg("alert-danger", "错误:这张图片编码不对哦");
};
img.src = this.result;
};
fr.readAsDataURL(file);
} else {
showMsg("alert-danger", "Error: This is not a PNG image!");
showMsg("alert-danger", "错误:皮肤文件必须为 PNG 格式");
}
}
};
@ -71,9 +71,9 @@ $("[title='Rotation']").click(function(){
function show2dPreview() {
$('#canvas3d').remove();
$('.operations').hide();
$("#skinpreview").html($('<p>Skin for Steve model:</p>').append($('<img />').addClass('skin2d').attr('src', '../skin/'+docCookies.getItem('uname')+'-steve.png?v='+Math.random())));
$("#skinpreview").append($('<p>Skin for Alex model:</p>').append($('<img />').addClass('skin2d').attr('src', '../skin/'+docCookies.getItem('uname')+'-alex.png?v='+Math.random())));
$("#skinpreview").append($('<p>Cape:</p>').append($('<img />').addClass('skin2d').attr('src', '../cape/'+docCookies.getItem('uname')+'.png?v='+Math.random())));
$("#skinpreview").html($('<p>Steve 模型的皮肤:</p>').append($('<img />').addClass('skin2d').attr('src', '../skin/'+docCookies.getItem('uname')+'-steve.png?v='+Math.random())));
$("#skinpreview").append($('<p>Alex 模型的皮肤:</p>').append($('<img />').addClass('skin2d').attr('src', '../skin/'+docCookies.getItem('uname')+'-alex.png?v='+Math.random())));
$("#skinpreview").append($('<p>披风:</p>').append($('<img />').addClass('skin2d').attr('src', '../cape/'+docCookies.getItem('uname')+'.png?v='+Math.random())));
$('#preview').html('3D Preview').attr('href', 'javascript:show3dPreview();');
}
@ -102,28 +102,28 @@ $("#upload").click(function(){
data: form_data,
processData: false,
beforeSend: function() {
showMsg('alert-info', 'Uploading...');
showMsg('alert-info', '正在上传。。');
},
success: function(json) {
console.log(json);
if (json.skin.errno == 0 && json.cape.errno == 0) {
showMsg('alert-success', 'Successfully uploaded.');
showMsg('alert-success', '上传成功!');
}
if (json.skin.errno != 0) {
showMsg('alert-danger', 'Error when uploading skin:\n'+json.skin.msg);
showMsg('alert-danger', '上传皮肤的时候出错了:\n'+json.skin.msg);
}
if (json.cape.errno != 0) {
showMsg('alert-danger', 'Error when uploading cape:\n'+json.cape.msg);
showMsg('alert-danger', '上传披风的时候出错了:\n'+json.cape.msg);
}
}
});
} else {
showMsg('alert-warning', 'No input file selected');
showMsg('alert-warning', '你还没有选择任何文件哦');
}
});
function changeModel(uname) {
showAlert("Sure to change?", function(){
showAlert('确定要更改优先皮肤模型吗?', function(){
$.ajax({
type: "POST",
url: "../ajax.php?action=model",

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-02-03 18:23:21
* @Last Modified by: prpr
* @Last Modified time: 2016-02-04 23:02:46
* @Last Modified time: 2016-02-05 21:12:29
*/
'use strict';
@ -33,7 +33,7 @@ function logout(callback) {
$("#logout").click(function(){
logout(function(json){
showAlert(json.msg + " Successfully logged out.", function(){
showAlert(json.msg, function(){
window.location = "../index.php";
});
});

View File

@ -1,24 +1,24 @@
<?php
/* Blessing Skin Server Database Name */
/* MySQL 数据库名 */
define('DB_NAME', 'skin');
/* MySQL Username */
/* MySQL 用户名 */
define('DB_USER', 'root');
/* MySQL Password */
/* MySQL 连接密码 */
define('DB_PASSWD', 'root');
/* MySQL Host */
/* MySQL 主机 */
define('DB_HOST', 'localhost');
/* Salt for encrypting token, Change it to any random string */
/* 盐,用于 token 加密,修改为任意随机字符串 */
define('SALT', '9tvsh55d*s');
/* Max amount of accounts per IP */
/* 同一 IP 最大可注册账户数 */
define('REGS_PER_IP', 2);
/* Which API to use, 0 for CustomSkinLoader API, 1 for UniSkinAPI */
/* 优先使用的 Json API0 为 CustomSkinLoader API, 1 为 UniSkinAPI */
define('API_TYPE', 0);
/* Letters only is recommended */
/* 站点名称,推荐英文(字体原因) */
define('SITE_TITLE', 'Blessing Skin Server');

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 15:11:35
* @Last Modified time: 2016-02-05 21:58:57
*/
class user
@ -43,9 +43,9 @@ class user
public static function checkValidPwd($passwd) {
if (strlen($passwd) > 16 || strlen($passwd) < 5) {
utils::raise(1, 'Illegal password. Password length should be in 5~16.');
utils::raise(1, '无效的密码。密码长度应该大于 6 并小于 15。');
} else if (utils::convertString($passwd) != $passwd) {
utils::raise(1, 'Illegal password. Password contains unsupported characters.');
utils::raise(1, '无效的密码。密码中包含了奇怪的字符。');
}
return true;
}
@ -146,7 +146,7 @@ class user
$json['skins'][$sec_model] = $this->getTexture($sec_model == "default" ? "steve" : "alex");
$json['cape'] = $this->getTexture('cape');
} else {
utils::raise(-1, 'Configuration error. Non-supported API_TYPE.');
utils::raise(-1, '配置文件错误:不支持的 API_TYPE。');
}
} else {
$json['errno'] = 1;

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 13:27:43
* @Last Modified time: 2016-02-05 21:59:56
*/
class utils
@ -55,7 +55,7 @@ class utils
public static function remove($filename) {
if(file_exists($filename)) {
if (!unlink($filename)) {
self::raise(-1, "Uncaught error when deleting $filename");
self::raise(-1, "删除 $filename 的时候出现了奇怪的问题。。请联系作者");
} else {
return true;
}

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-17 13:55:20
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 16:04:20
* @Last Modified time: 2016-02-05 21:13:05
*/
session_start();
$dir = dirname(__FILE__);
@ -42,9 +42,9 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
<ul class="pure-menu-list">
<li class="pure-menu-item">
<?php if (isset($_SESSION['uname'])) { ?>
<a href="./user/index.php" class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</a> | <span class="pure-menu-link" id="logout">Log out?</span>
<a href="./user/index.php" class="pure-menu-link">欢迎, <?php echo $_SESSION['uname']; ?></a> | <span class="pure-menu-link" id="logout">登出?</span>
<?php } else { ?>
<a id="login" href="javascript:;" class="pure-button pure-button-primary">Sign In</a>
<a id="login" href="javascript:;" class="pure-button pure-button-primary">登录</a>
<?php } ?>
</li>
</ul>
@ -60,11 +60,11 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
<div class="splash">
<h1 class="splash-head"><?php echo SITE_TITLE; ?></h1>
<p class="splash-subhead">
Just a simple open-source Minecraft skin server
开源的 PHP Minecraft 皮肤站
</p>
<?php if (!utils::getValue('uname', $_SESSION)) { ?>
<p>
<a id="register" href="javascript:;" class="pure-button pure-button-primary">Sign Up</a>
<a id="register" href="javascript:;" class="pure-button pure-button-primary">现在注册</a>
</p>
<?php } ?>
</div>
@ -76,28 +76,28 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
<div class="remodal" data-remodal-id="login-modal">
<button data-remodal-action="close" class="remodal-close"></button>
<h1 id="login-title">Sign In</h1>
<h1 id="login-title">登录</h1>
<div class="pure-form">
<input class="pure-input" id="uname" type="text" placeholder="Username">
<input class="pure-input" id="passwd" type="password" placeholder="Password">
<input class="pure-input" id="uname" type="text" placeholder="用户名">
<input class="pure-input" id="passwd" type="password" placeholder="密码">
<br />
<label for="keep" id="keep-label">
<input id="keep" type="checkbox"> Remember me
<input id="keep" type="checkbox"> 记住我
</label>
<button id="login-button" class="pure-button pure-button-primary">Sign In</button>
<button id="login-button" class="pure-button pure-button-primary">登录</button>
</div>
<div id="msg" class="alert"></div>
</div>
<div class="remodal" data-remodal-id="register-modal">
<button data-remodal-action="close" class="remodal-close"></button>
<h1 id="register-title">Sign Up</h1>
<h1 id="register-title">注册</h1>
<div class="pure-form">
<input class="pure-input" id="reg-uname" type="text" placeholder="Username">
<input class="pure-input" id="reg-passwd" type="password" placeholder="Password">
<input class="pure-input" id="reg-passwd2" type="password" placeholder="Comfirm Password">
<input class="pure-input" id="reg-uname" type="text" placeholder="用户名">
<input class="pure-input" id="reg-passwd" type="password" placeholder="密码">
<input class="pure-input" id="reg-passwd2" type="password" placeholder="确认密码">
<br />
<button id="register-button" class="pure-button pure-button-primary">Sign Up</button>
<button id="register-button" class="pure-button pure-button-primary">注册</button>
</div>
<div id="msg" class="alert"></div>
</div>

View File

@ -19,10 +19,10 @@ if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
if (isset($_SESSION['uname'])) {
$user = new user($_SESSION['uname']);
if ($_SESSION['token'] != $user->getToken()) {
header('Location: ../index.php?msg=Invalid token. Please login.');
header('Location: ../index.php?msg=无效的 token请重新登录。');
}
} else {
header('Location: ../index.php?msg=Illegal access. Please login.');
header('Location: ../index.php?msg=非法访问,请先登录。');
}
?>
<!DOCTYPE html>
@ -30,7 +30,7 @@ if (isset($_SESSION['uname'])) {
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload - <?php echo SITE_TITLE; ?></title>
<title>上传皮肤 - <?php echo SITE_TITLE; ?></title>
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="stylesheet" href="../libs/pure/pure-min.css">
<link rel="stylesheet" href="../libs/pure/grids-responsive-min.css">
@ -45,10 +45,10 @@ if (isset($_SESSION['uname'])) {
<a class="pure-menu-heading" href="../index.php"><?php echo SITE_TITLE; ?></a>
<ul class="pure-menu-list">
<li class="pure-menu-item">
<a class="pure-menu-link" href="profile.php">Profile</a>
<a class="pure-menu-link" href="profile.php">个人设置</a>
</li>
<li class="pure-menu-item">
<span class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</span> | <span class="pure-menu-link" id="logout">Log out?</span>
<span class="pure-menu-link">欢迎, <?php echo $_SESSION['uname']; ?></span> | <span class="pure-menu-link" id="logout">登出?</span>
</li>
</ul>
<div class="home-menu-blur">
@ -62,35 +62,35 @@ if (isset($_SESSION['uname'])) {
<div class="pure-g">
<div class="pure-u-md-1-2 pure-u-1">
<div class="panel panel-default">
<div class="panel-heading">Upload</div>
<div class="panel-heading">上传</div>
<div class="panel-body">
<div id="upload-form">
<p>Select a skin:</p>
<p>选择皮肤:</p>
<input type="file" id="skininput" name="skininput" accept="image/png" />
<br />
<p>Select a cape:</p>
<p>选择皮肤:</p>
<input type="file" id="capeinput" name="capeinput" accept="image/png" />
<br />
<input type="radio" id="model-steve" name="model" /><label for="model-steve">My skin fits on the classic Steve player model.</label>
<input type="radio" id="model-steve" name="model" /><label for="model-steve">我的皮肤适合传统 Steve 皮肤模型</label>
<br />
<input type="radio" id="model-alex" name="model" /><label for="model-alex">My skin fits on the new Alex player model.</label>
<input type="radio" id="model-alex" name="model" /><label for="model-alex">我的皮肤适合新版 Alex 皮肤模型</label>
<br /><br />
<button id="upload" class="pure-button pure-button-primary">Upload</button>
<a id="preview" href="javascript:show2dPreview();" class="pure-button">2D Preview</a>
<button id="upload" class="pure-button pure-button-primary">确认上传</button>
<a id="preview" href="javascript:show2dPreview();" class="pure-button">2D 皮肤预览</a>
</div>
<div id="msg" class="alert hide" role="alert"></div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Change Preferred Model</div>
<div class="panel-heading">修改优先皮肤模型</div>
<div class="panel-body">
<p>Your preference model is <b><?php echo $user->getPreference(); ?></b>. <a class="pure-button pure-button-default" style="margin: 0 3px;" href="javascript:changeModel();">Change?</a></p>
<p>你现在的优先皮肤模型是 <b><?php echo $user->getPreference(); ?></b> <a class="pure-button pure-button-default" style="margin: 0 3px;" href="javascript:changeModel();">更改</a></p>
</div>
</div>
</div>
<div class="pure-u-md-1-2 pure-u-1">
<div class="panel panel-default">
<div class="panel-heading">Preview
<div class="panel-heading">皮肤预览
<div class="operations">
<span title="Movements" class="glyphicon glyphicon-pause"></span>
<span title="Running" class="glyphicon glyphicon-forward"></span>
@ -112,7 +112,7 @@ if (isset($_SESSION['uname'])) {
<script type="text/javascript" src="../assets/js/user.utils.js"></script>
<?php if ($user->getTexture('alex') && ($user->getTexture('steve') == "")) {?>
<script type="text/javascript">
showMsg('alert-warning', 'It seems that you have only uploaded skin for Alex model. Note that Minecraft version < 1.8 does not support Alex model. Uploading external skin fit on Steve model is recommemded.');
showMsg('alert-warning', '看起来你只上传了适合 Alex 模型的皮肤。注意 Minecraft 版本低于 1.8 的皮肤 MOD 不支持双层皮肤。你最好再上传一个适用于 Steve 模型的皮肤,并将优先模型设置为 Alex 以获得在各个版本下的良好表现。');
</script>
<?php } ?>
</html>

View File

@ -3,7 +3,7 @@
* @Author: prpr
* @Date: 2016-02-03 16:12:45
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 16:05:18
* @Last Modified time: 2016-02-05 21:56:16
*/
session_start();
@ -18,10 +18,10 @@ if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
if (isset($_SESSION['uname'])) {
$user = new user($_SESSION['uname']);
if ($_SESSION['token'] != $user->getToken()) {
header('Location: ../index.php?msg=Invalid token. Please login.');
header('Location: ../index.php?msg=无效的 token请重新登录。');
}
} else {
header('Location: ../index.php?msg=Illegal access. Please login.');
header('Location: ../index.php?msg=非法访问,请先登录。');
}
?>
<!DOCTYPE html>
@ -29,7 +29,7 @@ if (isset($_SESSION['uname'])) {
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile - <?php echo SITE_TITLE; ?></title>
<title>个人设置 - <?php echo SITE_TITLE; ?></title>
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="stylesheet" href="../libs/pure/pure-min.css">
<link rel="stylesheet" href="../libs/pure/grids-responsive-min.css">
@ -49,7 +49,7 @@ if (isset($_SESSION['uname'])) {
<a class="pure-menu-link" href="index.php">Upload</a>
</li>
<li class="pure-menu-item">
<span class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</span> | <span class="pure-menu-link" id="logout">Log out?</span>
<span class="pure-menu-link">欢迎, <?php echo $_SESSION['uname']; ?></span> | <span class="pure-menu-link" id="logout">登出?</span>
</li>
</ul>
<div class="home-menu-blur">
@ -64,26 +64,25 @@ if (isset($_SESSION['uname'])) {
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2">
<div class="panel panel-default">
<div class="panel-heading">Change Password</div>
<div class="panel-heading">更改密码</div>
<div class="panel-body">
<div class="pure-form pure-form-stacked">
<input id="passwd" type="password" placeholder="Old password">
<input id="new-passwd" type="password" placeholder="New password">
<input id="confirm-pwd" type="password" placeholder="Repeat to confirm">
<button id="change" class="pure-button pure-button-primary">Change Password</button>
<input id="passwd" type="password" placeholder="旧的密码">
<input id="new-passwd" type="password" placeholder="新密码">
<input id="confirm-pwd" type="password" placeholder="确认密码">
<button id="change" class="pure-button pure-button-primary">修改密码</button>
</div>
</div>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2">
<div class="panel panel-danger">
<div class="panel-heading">Delete Account</div>
<div class="panel-heading">删除账号</div>
<div class="panel-body">
<p>Are you sure you want to delete your account?</p>
<p>You're about to delete your account on Blessing Skin Server.</p>
<p>This is permanent! No backups, no restores, no magic undo button.</p>
<p>We warned you, ok?</p>
<button id="delete" class="pure-button pure-button-error">I am sure.</button>
<p>确定要删除你在 <?php echo SITE_TITLE; ?> 上的账号吗?</p>
<p>此操作不可恢复!我们不提供任何备份,或者神奇的撤销按钮。</p>
<p>我们警告过你了,确定要这样做吗?</p>
<button id="delete" class="pure-button pure-button-error">删除我的账户</button>
</div>
</div>
</div>
@ -91,7 +90,7 @@ if (isset($_SESSION['uname'])) {
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2">
<div class="panel panel-default">
<div class="panel-heading">How To Use?</div>
<div class="panel-heading">如何使用?</div>
<div class="panel-body">
<p>Check it here: <a href="https://github.com/printempw/blessing-skin-server/blob/master/README.md">printempw/blessing-skin-server</a></p>
</div>
@ -100,9 +99,9 @@ if (isset($_SESSION['uname'])) {
<?php if ($user->is_admin) { ?>
<div class="pure-u-1 pure-u-md-1-2">
<div class="panel panel-default">
<div class="panel-heading">Welcome, administrator.</div>
<div class="panel-heading">欢迎,尊敬的管理员</div>
<div class="panel-body">
<p>Here manage your site: <a href="../admin/">Console</a></p>
<p>在这里管理你的皮肤站: <a href="../admin/">仪表盘</a></p>
</div>
</div>
</div>