add user/profile.php
This commit is contained in:
parent
99f0306c86
commit
6ffa0d85f4
100
assets/css/profile.style.css
Normal file
100
assets/css/profile.style.css
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-03 17:11:53
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-03 17:18:56
|
||||
*/
|
||||
.pure-form > *, .pure-button {
|
||||
width: 100%;
|
||||
margin: 10px 0 !important;
|
||||
}
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
position: relative !important;
|
||||
}
|
||||
@media screen and (min-width: 48em) {
|
||||
.container {
|
||||
width: 85%;
|
||||
}
|
||||
}
|
||||
body {
|
||||
color: #444;
|
||||
}
|
||||
@media screen and (max-width: 550px) {
|
||||
.pure-g:first-child {
|
||||
margin-top: 100px !important;
|
||||
}
|
||||
}
|
||||
.pure-g:first-child {
|
||||
margin-top: 75px;
|
||||
}
|
||||
.panel-default {
|
||||
border-color: #ddd!important;
|
||||
}
|
||||
.panel-danger {
|
||||
border-color: #ebccd1!important;
|
||||
}
|
||||
.panel {
|
||||
background-color: #fff;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
width: 90%;
|
||||
margin: 0 auto 20px;
|
||||
}
|
||||
.panel-danger>.panel-heading {
|
||||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
}
|
||||
.panel-default>.panel-heading {
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.panel-heading {
|
||||
padding: 10px 15px;
|
||||
border-bottom: 1px solid transparent;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
.panel-body {
|
||||
padding: 10px 15px 15px;
|
||||
}
|
||||
|
||||
.home-menu-blur {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -100;
|
||||
}
|
||||
.home-menu-wrp {
|
||||
height: 100%;
|
||||
background-color: rgba(255,255,255,0.4);
|
||||
}
|
||||
.home-menu-bg {
|
||||
background-image: url("../images/bg_stone.png");
|
||||
background-repeat: repeat;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
filter: blur(2px);
|
||||
-webkit-filter: blur(2px);
|
||||
-moz-filter: blur(2px);
|
||||
-o-filter: blur(2px);
|
||||
-ms-filter: blur(2px);
|
||||
box-shadow: rgba(0,0,0,0.1) 0 1px 2px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image:
|
||||
url("../images/bg_stone.png");
|
||||
background-repeat: repeat;
|
||||
}
|
||||
.pure-button-error {
|
||||
background: rgb(202, 60, 60);
|
||||
color: #fff;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-01-21 07:57:38
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-01-21 20:33:40
|
||||
* @Last Modified time: 2016-02-03 17:04:36
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
@ -22,6 +22,10 @@ html {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.home-menu {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: prpr
|
||||
* @Date: 2016-01-21 19:12:06
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-01-21 22:09:28
|
||||
* @Last Modified time: 2016-02-03 16:39:42
|
||||
*/
|
||||
|
||||
.home-menu-blur {
|
||||
@ -31,7 +31,7 @@
|
||||
box-shadow: rgba(0,0,0,0.1) 0 1px 2px;
|
||||
}
|
||||
|
||||
.container {
|
||||
body {
|
||||
background-image:
|
||||
url("../images/bg_stone.png");
|
||||
background-repeat: repeat;
|
||||
|
9
assets/js/profile.utils.js
Normal file
9
assets/js/profile.utils.js
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-03 17:21:46
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-03 17:21:54
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-16 23:01:33
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-03 15:52:29
|
||||
* @Last Modified time: 2016-02-03 18:06:13
|
||||
*/
|
||||
|
||||
class user
|
||||
@ -37,6 +37,10 @@ class user
|
||||
}
|
||||
}
|
||||
|
||||
public function changePasswd($new_passwd) {
|
||||
$this->db->update($this->uname, 'password', md5($new_passwd));
|
||||
}
|
||||
|
||||
public function getToken() {
|
||||
return $this->token;
|
||||
}
|
||||
@ -55,9 +59,11 @@ class user
|
||||
}
|
||||
|
||||
public function unRegister() {
|
||||
utils::remove("./textures/".$this->getTexture('skin'));
|
||||
utils::remove("./textures/".$this->getTexture('cape'));
|
||||
return utils::delete($this->uname);
|
||||
if (is_null($this->getTexture('skin')))
|
||||
utils::remove("./textures/".$this->getTexture('skin'));
|
||||
if (is_null($this->getTexture('skin')))
|
||||
utils::remove("./textures/".$this->getTexture('cape'));
|
||||
return $this->db->delete($this->uname);
|
||||
}
|
||||
|
||||
public function getTexture($type) {
|
||||
|
153
user/index.php
153
user/index.php
@ -13,17 +13,17 @@ require "$dir/config.php";
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : "";
|
||||
|
||||
if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
|
||||
$_SESSION['uname'] = $_COOKIE['uname'];
|
||||
$_SESSION['token'] = $_COOKIE['token'];
|
||||
$_SESSION['uname'] = $_COOKIE['uname'];
|
||||
$_SESSION['token'] = $_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.');
|
||||
}
|
||||
$user = new user($_SESSION['uname']);
|
||||
if ($_SESSION['token'] != $user->getToken()) {
|
||||
header('Location: ../index.php?msg=Invalid token. Please login.');
|
||||
}
|
||||
} else {
|
||||
header('Location: ../index.php?msg=Illegal access. Please login.');
|
||||
header('Location: ../index.php?msg=Illegal access. Please login.');
|
||||
}
|
||||
|
||||
?>
|
||||
@ -45,17 +45,20 @@ if (isset($_SESSION['uname'])) {
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
|
||||
<a class="pure-menu-heading" href="../index.php">Blessing Skin Server</a>
|
||||
<a href="javascript:;" title="Movements"><span class="glyphicon glyphicon-pause"></span></a>
|
||||
<a href="javascript:;" title="Running"><span class="glyphicon glyphicon-forward"></span></a>
|
||||
<a href="javascript:;" title="Rotation"><span class="glyphicon glyphicon-repeat"></span></a>
|
||||
<ul class="pure-menu-list">
|
||||
<li class="pure-menu-item">
|
||||
<a href="javascript:;" class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</a>
|
||||
</li>
|
||||
<li class="pure-menu-item">
|
||||
<a class="pure-menu-link" id="logout" href="javascript:;">Log out?</a>
|
||||
</li>
|
||||
<a class="pure-menu-heading" href="../index.php">Blessing Skin Server</a>
|
||||
<a href="javascript:;" title="Movements"><span class="glyphicon glyphicon-pause"></span></a>
|
||||
<a href="javascript:;" title="Running"><span class="glyphicon glyphicon-forward"></span></a>
|
||||
<a href="javascript:;" title="Rotation"><span class="glyphicon glyphicon-repeat"></span></a>
|
||||
<ul class="pure-menu-list">
|
||||
<li class="pure-menu-item">
|
||||
<a href="javascript:;" class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</a>
|
||||
</li>
|
||||
<li class="pure-menu-item">
|
||||
<a class="pure-menu-link" href="profile.php">Profile</a>
|
||||
</li>
|
||||
<li class="pure-menu-item">
|
||||
<a class="pure-menu-link" id="logout" href="javascript:;">Log out?</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="home-menu-blur">
|
||||
<div class="home-menu-wrp">
|
||||
@ -67,29 +70,29 @@ if (isset($_SESSION['uname'])) {
|
||||
|
||||
<?php if ($action == "preview") { ?>
|
||||
<div class="container">
|
||||
<div id="skinpreview"></div>
|
||||
<div id="skinpreview"></div>
|
||||
</div>
|
||||
<style>
|
||||
#canvas3d {
|
||||
margin: 8% auto;
|
||||
margin: 8% auto;
|
||||
}
|
||||
</style>
|
||||
<?php } else if ($action == "upload") { ?>
|
||||
<div class="container">
|
||||
<div class="upload-container">
|
||||
<h2 class="upload-title">Upload</h2>
|
||||
<div id="upload-form">
|
||||
<p>Select a skin:</p>
|
||||
<input type=file id="skininput" name="skininput" accept="image/png">
|
||||
<br />
|
||||
<p>Select a cape:</p>
|
||||
<input type=file id="capeinput" name="capeinput" accept="image/png">
|
||||
<br /><br />
|
||||
<button id="upload" class="pure-button pure-button-primary">Upload</button>
|
||||
<a href="?action=preview" class="pure-button">Preview</a>
|
||||
</div>
|
||||
<div id="msg" class="alert hide" role="alert" />
|
||||
</div>
|
||||
<div class="upload-container">
|
||||
<h2 class="upload-title">Upload</h2>
|
||||
<div id="upload-form">
|
||||
<p>Select a skin:</p>
|
||||
<input type=file id="skininput" name="skininput" accept="image/png">
|
||||
<br />
|
||||
<p>Select a cape:</p>
|
||||
<input type=file id="capeinput" name="capeinput" accept="image/png">
|
||||
<br /><br />
|
||||
<button id="upload" class="pure-button pure-button-primary">Upload</button>
|
||||
<a href="?action=preview" class="pure-button">Preview</a>
|
||||
</div>
|
||||
<div id="msg" class="alert hide" role="alert" />
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.upload-container {
|
||||
@ -100,49 +103,49 @@ if (isset($_SESSION['uname'])) {
|
||||
</style>
|
||||
<?php } else { ?>
|
||||
<div class="container pure-g">
|
||||
<div class="pure-u-2-3">
|
||||
<div id="skinpreview"></div>
|
||||
</div>
|
||||
<div class="pure-u-1-3">
|
||||
<div class="upload-container">
|
||||
<h2 class="upload-title">Upload</h2>
|
||||
<div id="upload-form">
|
||||
<p>Select a skin:</p>
|
||||
<input type=file id="skininput" name="skininput" accept="image/png">
|
||||
<br />
|
||||
<p>Select a cape:</p>
|
||||
<input type=file id="capeinput" name="capeinput" accept="image/png">
|
||||
<br /><br />
|
||||
<button id="upload" class="pure-button pure-button-primary">Upload</button>
|
||||
<a id="preview" href="?action=preview" class="pure-button">Preview</a>
|
||||
</div>
|
||||
<div id="msg" class="alert hide" role="alert" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="pure-u-2-3">
|
||||
<div id="skinpreview"></div>
|
||||
</div>
|
||||
<div class="pure-u-1-3">
|
||||
<div class="upload-container">
|
||||
<h2 class="upload-title">Upload</h2>
|
||||
<div id="upload-form">
|
||||
<p>Select a skin:</p>
|
||||
<input type=file id="skininput" name="skininput" accept="image/png">
|
||||
<br />
|
||||
<p>Select a cape:</p>
|
||||
<input type=file id="capeinput" name="capeinput" accept="image/png">
|
||||
<br /><br />
|
||||
<button id="upload" class="pure-button pure-button-primary">Upload</button>
|
||||
<a id="preview" href="?action=preview" class="pure-button">Preview</a>
|
||||
</div>
|
||||
<div id="msg" class="alert hide" role="alert" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
#preview {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
#skinpreview {
|
||||
display: none;
|
||||
}
|
||||
#preview {
|
||||
display: inline-block;
|
||||
}
|
||||
.pure-u-2-3 {
|
||||
width: 0%;
|
||||
}
|
||||
.pure-u-1-3 {
|
||||
width: 100%;
|
||||
}
|
||||
.upload-container {
|
||||
width: 70%;
|
||||
height: 50%;
|
||||
margin: 100px auto;
|
||||
}
|
||||
}
|
||||
#preview {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
#skinpreview {
|
||||
display: none;
|
||||
}
|
||||
#preview {
|
||||
display: inline-block;
|
||||
}
|
||||
.pure-u-2-3 {
|
||||
width: 0%;
|
||||
}
|
||||
.pure-u-1-3 {
|
||||
width: 100%;
|
||||
}
|
||||
.upload-container {
|
||||
width: 70%;
|
||||
height: 50%;
|
||||
margin: 100px auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<?php } ?>
|
||||
|
||||
|
101
user/profile.php
Normal file
101
user/profile.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* @Author: prpr
|
||||
* @Date: 2016-02-03 16:12:45
|
||||
* @Last Modified by: prpr
|
||||
* @Last Modified time: 2016-02-03 17:21:31
|
||||
*/
|
||||
|
||||
session_start();
|
||||
$dir = dirname(dirname(__FILE__));
|
||||
require "$dir/includes/autoload.inc.php";
|
||||
require "$dir/config.php";
|
||||
|
||||
if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
|
||||
$_SESSION['uname'] = $_COOKIE['uname'];
|
||||
$_SESSION['token'] = $_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.');
|
||||
}
|
||||
} else {
|
||||
header('Location: ../index.php?msg=Illegal access. Please login.');
|
||||
} ?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Profile - Blessing Skin Server</title>
|
||||
<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/profile.style.css">
|
||||
<link rel="stylesheet" href="../libs/ply/ply.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
|
||||
<a class="pure-menu-heading" href="../index.php">Blessing Skin Server</a>
|
||||
<a href="javascript:;" title="Movements"><span class="glyphicon glyphicon-pause"></span></a>
|
||||
<a href="javascript:;" title="Running"><span class="glyphicon glyphicon-forward"></span></a>
|
||||
<a href="javascript:;" title="Rotation"><span class="glyphicon glyphicon-repeat"></span></a>
|
||||
<ul class="pure-menu-list">
|
||||
<li class="pure-menu-item">
|
||||
<a href="javascript:;" class="pure-menu-link">Welcome, <?php echo $_SESSION['uname']; ?>!</a>
|
||||
</li>
|
||||
<li class="pure-menu-item">
|
||||
<a class="pure-menu-link" id="logout" href="javascript:;">Log out?</a>
|
||||
</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="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-body">
|
||||
<form class="pure-form pure-form-stacked">
|
||||
<input id="password" type="password" placeholder="Old password">
|
||||
<input id="password" type="password" placeholder="New password">
|
||||
<input id="password" type="password" placeholder="Repeat to confirm">
|
||||
<button class="pure-button pure-button-primary">Change Password</button>
|
||||
</form>
|
||||
</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-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 class="pure-button pure-button-error">I am sure.</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
© <a class="copy" href="https://prinzeugen.net">Blessing Studio</a> 2016
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript" src="../libs/jquery/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="../libs/ply/ply.min.js"></script>
|
||||
<script type="text/javascript" src="../assets/js/profile.utils.js"></script>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user