add some new shit

This commit is contained in:
printempw 2016-01-22 15:06:47 +08:00
parent 41bcbae99e
commit 7ee277f67e
3 changed files with 16 additions and 5 deletions

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-01-21 13:55:44
* @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:32:22
* @Last Modified time: 2016-01-22 15:03:08
*/
'use strict';
@ -64,6 +64,7 @@ $("body").on("click", "#register-button", function(){
if (json.errno == 0) {
showAlert(json.msg + " Please log in.");
$('[data-remodal-id=register-modal]').remodal().close();
showMsg('hide', "");
} else {
showAlert(json.msg);
}

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:52:44
* @Last Modified time: 2016-01-22 15:04:59
*/
class user {
@ -51,6 +51,12 @@ class user {
}
}
public function unRegister() {
utils::remove("./textures/".$this->getTexture('skin'));
utils::remove("./textures/".$this->getTexture('cape'));
return utils::delete($this->uname);
}
public function getTexture($type) {
if ($type == "skin") {
return utils::select('username', $this->uname)['skin_hash'];
@ -102,4 +108,3 @@ class user {
}
}
?>

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:11:23
* @Last Modified time: 2016-01-22 15:04:56
*/
$dir = dirname(dirname(__FILE__));
require "$dir/config.php";
@ -65,7 +65,7 @@ class utils {
$passwd = $array['passwd'];
$ip = $array['ip'];
self::connect();
$query = self::query("INSERT INTO users (username, password, ip) VALUES ('$uname', '$passwd', '$ip')");
$query = self::query("INSERT INTO users (username, password, ip, preference) VALUES ('$uname', '$passwd', '$ip', 'default')");
return $query;
}
@ -74,6 +74,11 @@ class utils {
return $query;
}
public static function delete($uname) {
$query = self::query("DELETE from users WHERE username='$uname'");
return $query;
}
/**
* Rename uploaded file
*