blessing-skin-server/index.php

117 lines
4.4 KiB
PHP
Raw Normal View History

<?php
/**
* @Author: printempw
* @Date: 2016-01-17 13:55:20
* @Last Modified by: prpr
2016-02-06 23:18:07 +08:00
* @Last Modified time: 2016-02-06 23:06:24
*/
2016-02-02 21:22:53 +08:00
session_start();
2016-01-22 14:47:18 +08:00
$dir = dirname(__FILE__);
2016-02-02 21:22:53 +08:00
require "$dir/includes/autoload.inc.php";
2016-02-04 23:49:31 +08:00
2016-02-06 23:18:07 +08:00
Database::checkConfig();
2016-02-02 21:22:53 +08:00
// Auto load cookie value to session
if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
2016-02-06 23:18:07 +08:00
$user = new User($_COOKIE['uname']);
2016-02-02 21:22:53 +08:00
if ($_COOKIE['token'] == $user->getToken()) {
$_SESSION['uname'] = $_COOKIE['uname'];
$_SESSION['token'] = $user->getToken();
}
2016-02-04 23:49:31 +08:00
}
?>
2016-01-22 16:21:09 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2016-02-05 16:08:37 +08:00
<title><?php echo SITE_TITLE; ?></title>
2016-02-03 23:06:21 +08:00
<link rel="shortcut icon" href="./assets/images/favicon.ico">
2016-01-22 16:21:09 +08:00
<link rel="stylesheet" href="./libs/pure/pure-min.css">
<link rel="stylesheet" href="./libs/pure/grids-responsive-min.css">
<link rel="stylesheet" href="./assets/css/style.css">
<link rel="stylesheet" href="./assets/css/index.style.css">
<link rel="stylesheet" href="./libs/remodal/remodal.css">
<link rel="stylesheet" href="./libs/ply/ply.css">
<link rel="stylesheet" href="./libs/remodal/remodal-default-theme.css">
</head>
<body>
<div class="header">
<div class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
2016-02-05 16:08:37 +08:00
<a class="pure-menu-heading" href="#"><?php echo SITE_TITLE; ?></a>
2016-01-22 16:21:09 +08:00
<ul class="pure-menu-list">
<li class="pure-menu-item">
2016-02-04 23:49:31 +08:00
<?php if (isset($_SESSION['uname'])) { ?>
2016-02-05 23:29:43 +08:00
<a href="./user/index.php" class="pure-menu-link">欢迎,<?php echo $_SESSION['uname']; ?></a>|<span class="pure-menu-link" id="logout">登出?</span>
2016-01-22 16:21:09 +08:00
<?php } else { ?>
2016-02-05 22:08:06 +08:00
<a id="login" href="javascript:;" class="pure-button pure-button-primary">登录</a>
2016-01-22 16:21:09 +08:00
<?php } ?>
</li>
</ul>
<div class="home-menu-blur">
<div class="home-menu-wrp">
<div class="home-menu-bg"></div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="splash">
2016-02-05 16:08:37 +08:00
<h1 class="splash-head"><?php echo SITE_TITLE; ?></h1>
2016-01-22 16:21:09 +08:00
<p class="splash-subhead">
2016-02-05 22:08:06 +08:00
开源的 PHP Minecraft 皮肤站
2016-01-22 16:21:09 +08:00
</p>
2016-02-06 23:18:07 +08:00
<?php if (!Utils::getValue('uname', $_SESSION)) { ?>
2016-01-22 16:21:09 +08:00
<p>
2016-02-05 22:08:06 +08:00
<a id="register" href="javascript:;" class="pure-button pure-button-primary">现在注册</a>
2016-01-22 16:21:09 +08:00
</p>
<?php } ?>
</div>
</div>
<div class="footer">
&copy; <a class="copy" href="https://prinzeugen.net">Blessing Studio</a> 2016
</div>
<div class="remodal" data-remodal-id="login-modal">
<button data-remodal-action="close" class="remodal-close"></button>
2016-02-05 22:08:06 +08:00
<h1 id="login-title">登录</h1>
2016-01-22 16:21:09 +08:00
<div class="pure-form">
2016-02-05 22:08:06 +08:00
<input class="pure-input" id="uname" type="text" placeholder="用户名">
<input class="pure-input" id="passwd" type="password" placeholder="密码">
2016-01-22 16:21:09 +08:00
<br />
<label for="keep" id="keep-label">
2016-02-05 22:08:06 +08:00
<input id="keep" type="checkbox"> 记住我
2016-01-22 16:21:09 +08:00
</label>
2016-02-05 22:08:06 +08:00
<button id="login-button" class="pure-button pure-button-primary">登录</button>
2016-01-22 16:21:09 +08:00
</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>
2016-02-05 22:08:06 +08:00
<h1 id="register-title">注册</h1>
2016-01-22 16:21:09 +08:00
<div class="pure-form">
2016-02-05 22:08:06 +08:00
<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="确认密码">
2016-01-22 16:21:09 +08:00
<br />
2016-02-05 22:08:06 +08:00
<button id="register-button" class="pure-button pure-button-primary">注册</button>
2016-01-22 16:21:09 +08:00
</div>
<div id="msg" class="alert"></div>
</div>
<script type="text/javascript" src="./libs/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="./libs/cookie.js"></script>
<script type="text/javascript" src="./libs/remodal/remodal.min.js"></script>
<script type="text/javascript" src="./libs/ply/ply.min.js"></script>
<script type="text/javascript" src="./assets/js/utils.js"></script>
<script type="text/javascript" src="./assets/js/index.utils.js"></script>
2016-01-22 16:21:09 +08:00
<?php
2016-02-06 23:18:07 +08:00
if ($msg = Utils::getValue('msg', $_GET)) { ?>
2016-02-04 23:49:31 +08:00
<script type="text/javascript"> showAlert("<?php echo $msg; ?>"); </script>
2016-01-22 16:21:09 +08:00
<?php } ?>
</body>
</html>